summaryrefslogtreecommitdiff
path: root/integration_tests/example_filesystems_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integration_tests/example_filesystems_test.go')
-rw-r--r--integration_tests/example_filesystems_test.go46
1 files changed, 44 insertions, 2 deletions
diff --git a/integration_tests/example_filesystems_test.go b/integration_tests/example_filesystems_test.go
index 3beca60..e3df950 100644
--- a/integration_tests/example_filesystems_test.go
+++ b/integration_tests/example_filesystems_test.go
@@ -11,8 +11,7 @@ import (
const statusTxtContent = "It works!\n"
-// checkStatusTxt - read file "filename" and verify that it contains
-// "It works!\n"
+// checkExampleFS - verify that "dir" contains the expected test files
func checkExampleFS(t *testing.T, dir string) {
// Read regular file
statusFile := filepath.Join(dir, "status.txt")
@@ -47,6 +46,27 @@ func checkExampleFS(t *testing.T, dir string) {
testMkdirRmdir(t, dir)
}
+// checkExampleFSLongnames - verify that "dir" contains the expected test files
+// plus the long file name test file
+func checkExampleFSLongnames(t *testing.T, dir string) {
+ // regular tests
+ checkExampleFS(t, dir)
+ // long name test file
+ longname := "longname_255_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +
+ "xxxxxxxxxxxxxxxxxxxxxxxx"
+ contentBytes, err := ioutil.ReadFile(filepath.Join(dir, longname))
+ if err != nil {
+ t.Fatal(err)
+ }
+ content := string(contentBytes)
+ if content != statusTxtContent {
+ t.Errorf("longname_255: unexpected content: %s\n", content)
+ }
+
+}
+
// Test example_filesystems/v0.4
// with password mount and -masterkey mount
func TestExampleFSv04(t *testing.T) {
@@ -159,3 +179,25 @@ func TestExampleFSv07(t *testing.T) {
t.Error(err)
}
}
+
+// Test example_filesystems/v0.9
+// (gocryptfs v0.9 introduced long file name support)
+func TestExampleFSv09(t *testing.T) {
+ cDir := "example_filesystems/v0.9"
+ pDir := tmpDir + "TestExampleFsV09/"
+ err := os.Mkdir(pDir, 0777)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mount(cDir, pDir, "-extpass", "echo test")
+ checkExampleFSLongnames(t, pDir)
+ unmount(pDir)
+ mount(cDir, pDir, "-masterkey", "1cafe3f4-bc316466-2214c47c-ecd89bf3-"+
+ "4e078fe4-f5faeea7-8b7cab02-884f5e1c")
+ checkExampleFSLongnames(t, pDir)
+ unmount(pDir)
+ err = os.Remove(pDir)
+ if err != nil {
+ t.Error(err)
+ }
+}