From 2a9dea2973a6141e8efdf8bd26d8ddb2d2c35fc4 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 20 Aug 2021 15:57:40 +0200 Subject: -deterministic-names: accept flag on -init And store it in gocryptfs.conf (=remove DirIV feature flag). --- tests/cli/cli_test.go | 6 ++++++ tests/deterministic_names/deterministic_names_test.go | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 85a8006..f4162f8 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -995,3 +995,9 @@ func TestMountCreat(t *testing.T) { test_helpers.UnmountPanic(mnt) } } + +// Test -init -deterministic-names +func TestInitDeterministicNames(t *testing.T) { + dir := test_helpers.InitFS(t, "-deterministic-names") + +} diff --git a/tests/deterministic_names/deterministic_names_test.go b/tests/deterministic_names/deterministic_names_test.go index 1b355df..e94b0b6 100644 --- a/tests/deterministic_names/deterministic_names_test.go +++ b/tests/deterministic_names/deterministic_names_test.go @@ -3,11 +3,13 @@ package deterministic_names // integration tests that target "-deterministic-names" specifically import ( + "fmt" "io/ioutil" "os" "path/filepath" "testing" + "github.com/rfjakob/gocryptfs/internal/configfile" "github.com/rfjakob/gocryptfs/tests/test_helpers" ) @@ -19,8 +21,18 @@ var testPw = []byte("test") // Create and mount "-deterministic-names" fs func TestMain(m *testing.M) { cDir = test_helpers.InitFS(nil, "-deterministic-names") + // Check config file sanity + _, c, err := configfile.LoadAndDecrypt(cDir+"/"+configfile.ConfDefaultName, testPw) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + if c.IsFeatureFlagSet(configfile.FlagDirIV) { + fmt.Println("DirIV flag should be off") + os.Exit(1) + } pDir = cDir + ".mnt" - test_helpers.MountOrExit(cDir, pDir, "-deterministic-names", "-extpass", "echo test") + test_helpers.MountOrExit(cDir, pDir, "-extpass", "echo test") r := m.Run() test_helpers.UnmountPanic(pDir) os.Exit(r) -- cgit v1.2.3