aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-08 21:45:11 +0200
committerJakob Unterwurzacher2016-10-08 21:45:11 +0200
commiteb51a1ed20696460a9cdab2caa8f5d6e1e8dee04 (patch)
treeaeeb912eaab42e311175a563c0b9c278f91f3791
parent3c2c3453ad7d31927a2faee02bea34388c1da830 (diff)
tests: add v1.1-reverse example filesystem
-rw-r--r--tests/example_filesystems/example_filesystems_test.go29
-rw-r--r--tests/example_filesystems/example_test_helpers.go12
-rw-r--r--tests/example_filesystems/v1.1-reverse/.gocryptfs.reverse.conf19
l---------tests/example_filesystems/v1.1-reverse/abs1
-rw-r--r--tests/example_filesystems/v1.1-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1
l---------tests/example_filesystems/v1.1-reverse/rel1
-rw-r--r--tests/example_filesystems/v1.1-reverse/status.txt1
7 files changed, 60 insertions, 4 deletions
diff --git a/tests/example_filesystems/example_filesystems_test.go b/tests/example_filesystems/example_filesystems_test.go
index 34514c5..71fe0a9 100644
--- a/tests/example_filesystems/example_filesystems_test.go
+++ b/tests/example_filesystems/example_filesystems_test.go
@@ -152,8 +152,35 @@ func TestExampleFSv11(t *testing.T) {
test_helpers.UnmountPanic(pDir)
pDir = pDir + ".2"
test_helpers.MountOrFatal(t, cDir, pDir, "-masterkey",
- "be505f7d-54871394-2c0c2481-1bdcd0d8-9113b08a-0f7b4dfc-851c96da-55ef36b5",
+ "eaf371c3-f9a55336-8819f22b-7bccd7c2-a738cf61-7261c658-14c28a03-9428992b",
"-aessiv", opensslOpt)
checkExampleFSLongnames(t, pDir)
test_helpers.UnmountPanic(pDir)
}
+
+// gocryptfs v1.1 introduced reverse mode
+func TestExampleFSv11reverse(t *testing.T) {
+ dirA := "v1.1-reverse"
+ dirB := test_helpers.TmpDir + "/" + dirA + ".B"
+ err := os.Mkdir(dirB, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ dirC := test_helpers.TmpDir + "/" + dirA + ".C"
+ err = os.Mkdir(dirC, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ test_helpers.MountOrFatal(t, dirA, dirB, "-reverse", "-extpass", "echo test", opensslOpt)
+ test_helpers.MountOrFatal(t, dirB, dirC, "-extpass", "echo test", opensslOpt)
+ checkExampleFSrw(t, dirC, false)
+ test_helpers.UnmountPanic(dirC)
+ test_helpers.UnmountPanic(dirB)
+
+ m := "68b51855-042abd80-635ae1ba-90152a78-2ec2d243-832ac72a-eab0561a-f2d37913"
+ test_helpers.MountOrFatal(t, dirA, dirB, "-reverse", "-masterkey", m, opensslOpt)
+ test_helpers.MountOrFatal(t, dirB, dirC, "-aessiv", "-masterkey", m, opensslOpt)
+ checkExampleFSrw(t, dirC, false)
+ test_helpers.UnmountPanic(dirC)
+ test_helpers.UnmountPanic(dirB)
+}
diff --git a/tests/example_filesystems/example_test_helpers.go b/tests/example_filesystems/example_test_helpers.go
index e4c03ad..615e4c1 100644
--- a/tests/example_filesystems/example_test_helpers.go
+++ b/tests/example_filesystems/example_test_helpers.go
@@ -48,10 +48,17 @@ func checkExampleFS(t *testing.T, dir string, rw bool) {
}
// checkExampleFSLongnames - verify that "dir" contains the expected test files
-// plus the long file name test file
+// plus the long file name test file.
+// Also tests simple directory operations.
func checkExampleFSLongnames(t *testing.T, dir string) {
+ checkExampleFSrw(t, dir, true)
+}
+
+// checkExampleFSrw is like checkExampleFSLongnames but gives the caller the
+// choice if he wants to run tests that write to the FS.
+func checkExampleFSrw(t *testing.T, dir string, rw bool) {
// regular tests
- checkExampleFS(t, dir, true)
+ checkExampleFS(t, dir, rw)
// long name test file
longname := "longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
@@ -65,5 +72,4 @@ func checkExampleFSLongnames(t *testing.T, dir string) {
if content != statusTxtContent {
t.Errorf("longname_255: unexpected content: %s\n", content)
}
-
}
diff --git a/tests/example_filesystems/v1.1-reverse/.gocryptfs.reverse.conf b/tests/example_filesystems/v1.1-reverse/.gocryptfs.reverse.conf
new file mode 100644
index 0000000..9095ef5
--- /dev/null
+++ b/tests/example_filesystems/v1.1-reverse/.gocryptfs.reverse.conf
@@ -0,0 +1,19 @@
+{
+ "Creator": "gocryptfs v1.1-beta1-33-gf054353-dirty",
+ "EncryptedKey": "GD7CQzhKMs4r8B/jc7eNNAffyMn4Z2A0tH9EC50y6v5y6amJdU6NQK5xLPWpWSc45si5L26VOVhT8dhz",
+ "ScryptObject": {
+ "Salt": "G/Cpk6TnscJzx1fae9t8guejwoPk1lsGkkcljIMjJdw=",
+ "N": 1024,
+ "R": 8,
+ "P": 1,
+ "KeyLen": 32
+ },
+ "Version": 2,
+ "FeatureFlags": [
+ "GCMIV128",
+ "DirIV",
+ "EMENames",
+ "LongNames",
+ "AESSIV"
+ ]
+} \ No newline at end of file
diff --git a/tests/example_filesystems/v1.1-reverse/abs b/tests/example_filesystems/v1.1-reverse/abs
new file mode 120000
index 0000000..e1740fa
--- /dev/null
+++ b/tests/example_filesystems/v1.1-reverse/abs
@@ -0,0 +1 @@
+/a/b/c/d \ No newline at end of file
diff --git a/tests/example_filesystems/v1.1-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx b/tests/example_filesystems/v1.1-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
new file mode 100644
index 0000000..68300b8
--- /dev/null
+++ b/tests/example_filesystems/v1.1-reverse/longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -0,0 +1 @@
+It works!
diff --git a/tests/example_filesystems/v1.1-reverse/rel b/tests/example_filesystems/v1.1-reverse/rel
new file mode 120000
index 0000000..8279c75
--- /dev/null
+++ b/tests/example_filesystems/v1.1-reverse/rel
@@ -0,0 +1 @@
+status.txt \ No newline at end of file
diff --git a/tests/example_filesystems/v1.1-reverse/status.txt b/tests/example_filesystems/v1.1-reverse/status.txt
new file mode 100644
index 0000000..68300b8
--- /dev/null
+++ b/tests/example_filesystems/v1.1-reverse/status.txt
@@ -0,0 +1 @@
+It works!