tests: do not create gocryptfs.diriv if plaintextnames==true
This commit is contained in:
parent
6b5d977cce
commit
2a11906963
@ -1,13 +1,13 @@
|
||||
package integration_tests
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
@ -22,7 +22,7 @@ const defaultCipherDir = tmpDir + "cipher/"
|
||||
const gocryptfsBinary = "../gocryptfs"
|
||||
|
||||
// resetTmpDir - delete old tmp dir, create new one, write gocryptfs.diriv
|
||||
func resetTmpDir() {
|
||||
func resetTmpDir(plaintextNames bool) {
|
||||
fu := exec.Command("fusermount", "-z", "-u", defaultPlainDir)
|
||||
fu.Run()
|
||||
|
||||
@ -43,19 +43,22 @@ func resetTmpDir() {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if !plaintextNames {
|
||||
err = nametransform.WriteDirIV(defaultCipherDir)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mount CIPHERDIR "c" on PLAINDIR "p"
|
||||
func mount(c string, p string, extraArgs ...string) {
|
||||
var args []string
|
||||
args = append(args, extraArgs...)
|
||||
args = append(args, "-q", "-wpanic")
|
||||
//args = append(args, "--fusedebug")
|
||||
args = append(args, "-nosyslog", "-q", "-wpanic")
|
||||
//args = append(args, "-fusedebug")
|
||||
//args = append(args, "-d")
|
||||
args = append(args, c)
|
||||
args = append(args, p)
|
||||
cmd := exec.Command(gocryptfsBinary, args...)
|
||||
@ -205,7 +208,7 @@ func verifyExistence(path string) bool {
|
||||
//t.Log(err)
|
||||
return false
|
||||
}
|
||||
for _, i := range(fi) {
|
||||
for _, i := range fi {
|
||||
if i.Name() == name {
|
||||
return true
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package integration_tests
|
||||
// File reading, writing, modification, truncate
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
@ -13,6 +12,7 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ func TestMain(m *testing.M) {
|
||||
if testing.Verbose() {
|
||||
fmt.Println("***** Testing with OpenSSL")
|
||||
}
|
||||
resetTmpDir() // <- this also create gocryptfs.diriv
|
||||
resetTmpDir(false) // <- this also create gocryptfs.diriv
|
||||
mount(defaultCipherDir, defaultPlainDir, "--zerokey")
|
||||
r := m.Run()
|
||||
unmount(defaultPlainDir)
|
||||
@ -43,7 +43,7 @@ func TestMain(m *testing.M) {
|
||||
if testing.Verbose() {
|
||||
fmt.Println("***** Testing with native Go crypto")
|
||||
}
|
||||
resetTmpDir()
|
||||
resetTmpDir(false)
|
||||
mount(defaultCipherDir, defaultPlainDir, "--zerokey", "--openssl=false")
|
||||
r = m.Run()
|
||||
unmount(defaultPlainDir)
|
||||
@ -55,7 +55,7 @@ func TestMain(m *testing.M) {
|
||||
if testing.Verbose() {
|
||||
fmt.Println("***** Testing \"--plaintextnames\"")
|
||||
}
|
||||
resetTmpDir()
|
||||
resetTmpDir(true) // do not create gocryptfs.diriv
|
||||
mount(defaultCipherDir, defaultPlainDir, "--zerokey", "--plaintextnames")
|
||||
plaintextNames = true
|
||||
r = m.Run()
|
||||
|
Loading…
Reference in New Issue
Block a user