diff options
Diffstat (limited to 'gocryptfs_main/main_test.go')
-rw-r--r-- | gocryptfs_main/main_test.go | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/gocryptfs_main/main_test.go b/gocryptfs_main/main_test.go index 218c256..f171a8c 100644 --- a/gocryptfs_main/main_test.go +++ b/gocryptfs_main/main_test.go @@ -10,13 +10,27 @@ import ( "os" "os/exec" "testing" - "time" ) const tmpDir = "../tmp/" const plainDir = tmpDir + "plain/" const cipherDir = tmpDir + "cipher/" +func mount(extraArgs ...string) { + var args []string + args = append(args, extraArgs...) + args = append(args, cipherDir) + args = append(args, plainDir) + c := exec.Command("../gocryptfs", args...) + c.Stdout = os.Stdout + c.Stderr = os.Stderr + err := c.Run() + if err != nil { + fmt.Println(err) + os.Exit(1) + } +} + func unmount() error { fu := exec.Command("fusermount", "-z", "-u", plainDir) fu.Stdout = os.Stdout @@ -35,6 +49,7 @@ func md5fn(filename string) string { return hash } +// This is the entry point for the tests func TestMain(m *testing.M) { fu := exec.Command("fusermount", "-z", "-u", plainDir) @@ -52,17 +67,14 @@ func TestMain(m *testing.M) { panic("Could not create cipherDir") } - //c := exec.Command("./gocryptfs", "--zerokey", "--cpuprofile", "/tmp/gcfs.cpu", cipherDir, plainDir) - c := exec.Command("./gocryptfs_main", "--zerokey", cipherDir, plainDir) - c.Stdout = os.Stdout - c.Stderr = os.Stderr - go c.Run() - - time.Sleep(3 * time.Second) - + mount("--zerokey", "--openssl=false") r := m.Run() + unmount() + mount("--zerokey") + r = m.Run() unmount() + os.Exit(r) } |