aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-05-01 12:47:54 +0200
committerJakob Unterwurzacher2019-05-01 13:12:44 +0200
commit41dfbe67f827ecaebd7dd81a079f38a676288800 (patch)
tree00bfdad2b9ee0aa9b07e8b02ff66018dfa8fecda
parentdcd1068517d82d327cc3db108d1e714dad38ecc2 (diff)
test_helpers: better function comments for InitFS and Mount
It's confusing that you must pass "-extpass" for Mount but not for InitFS. Note that in the comment.
-rw-r--r--tests/test_helpers/helpers.go9
-rw-r--r--tests/test_helpers/mount_unmount.go9
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index f010a56..fd36f76 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -125,10 +125,11 @@ func ResetTmpDir(createDirIV bool) {
}
}
-// InitFS calls "gocryptfs -init" on a new directory in TmpDir, passing
-// "extraArgs" in addition to useful defaults.
+// InitFS creates a new empty cipherdir and calls
//
-// The returned cipherdir has NO trailing slash.
+// gocryptfs -q -init -extpass "echo test" -scryptn=10 $extraArgs $cipherdir
+//
+// It returns cipherdir without a trailing slash.
func InitFS(t *testing.T, extraArgs ...string) string {
dir, err := ioutil.TempDir(TmpDir, "")
if err != nil {
@@ -149,7 +150,7 @@ func InitFS(t *testing.T, extraArgs ...string) string {
err = cmd.Run()
if err != nil {
if t != nil {
- t.Fatalf("InitFS with args %v failed: %v", args, err)
+ t.Fatalf("InitFS with args %q failed: %v", args, err)
} else {
log.Panic(err)
}
diff --git a/tests/test_helpers/mount_unmount.go b/tests/test_helpers/mount_unmount.go
index 5e5b6f3..30d1c0d 100644
--- a/tests/test_helpers/mount_unmount.go
+++ b/tests/test_helpers/mount_unmount.go
@@ -26,6 +26,9 @@ type mountInfo struct {
// Mount CIPHERDIR "c" on PLAINDIR "p"
// Creates "p" if it does not exist.
+//
+// Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for
+// getting the master key) explicitely.
func Mount(c string, p string, showOutput bool, extraArgs ...string) error {
args := []string{"-q", "-wpanic", "-nosyslog", "-fg", fmt.Sprintf("-notifypid=%d", os.Getpid())}
args = append(args, extraArgs...)
@@ -93,6 +96,9 @@ func Mount(c string, p string, showOutput bool, extraArgs ...string) error {
}
// MountOrExit calls Mount() and exits on failure.
+//
+// Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for
+// getting the master key) explicitely.
func MountOrExit(c string, p string, extraArgs ...string) {
err := Mount(c, p, true, extraArgs...)
if err != nil {
@@ -102,6 +108,9 @@ func MountOrExit(c string, p string, extraArgs ...string) {
}
// MountOrFatal calls Mount() and calls t.Fatal() on failure.
+//
+// Contrary to InitFS(), you MUST passt "-extpass=echo test" (or another way for
+// getting the master key) explicitely.
func MountOrFatal(t *testing.T, c string, p string, extraArgs ...string) {
err := Mount(c, p, true, extraArgs...)
if err != nil {