summaryrefslogtreecommitdiff
path: root/gocryptfs_main/main_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-06 20:24:52 +0200
committerJakob Unterwurzacher2015-10-06 20:24:52 +0200
commit39ea272e233504a710ce6885434984b2f45fb398 (patch)
tree483583a5f1cea83858f8b9ad8c2d81857954ce6d /gocryptfs_main/main_test.go
parentc2bd208bbe2ab1b328435bb7ddd72a2268f8aa39 (diff)
Add "--openssl=false" command line option
Also make main_test try both variants
Diffstat (limited to 'gocryptfs_main/main_test.go')
-rw-r--r--gocryptfs_main/main_test.go30
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)
}