tests: add v0.9 example filesystem with a 255-byte filename
gocryptfs v0.9 introduced long file names, so lets add an example filesystem that has that feature flag set. Operations on long file names are tested in the regular integration tests as well.
This commit is contained in:
parent
2e2ee0a038
commit
72f8915843
@ -0,0 +1 @@
|
||||
5nI119EbCRtgT8AwTDPmxCuORvbGV4xdtmqnur7KK9ufir-ALyneV7Iy
|
Binary file not shown.
17
integration_tests/example_filesystems/v0.9/gocryptfs.conf
Normal file
17
integration_tests/example_filesystems/v0.9/gocryptfs.conf
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"EncryptedKey": "sAB/dsiDbFBbMr7ppsB3Fu81hVr6BBxlcfY1wZYRHlRvRV2uwRdYAACNM39CDxLBHZuNjk9UyWh87McP",
|
||||
"ScryptObject": {
|
||||
"Salt": "3mphl9Hmhzd6exmc8Um0jOOCgR8hAYvbzbEpTnIEMPg=",
|
||||
"N": 1024,
|
||||
"R": 8,
|
||||
"P": 1,
|
||||
"KeyLen": 32
|
||||
},
|
||||
"Version": 2,
|
||||
"FeatureFlags": [
|
||||
"GCMIV128",
|
||||
"DirIV",
|
||||
"EMENames",
|
||||
"LongNames"
|
||||
]
|
||||
}
|
@ -0,0 +1 @@
|
||||
˙~HŐćá‡A|Ô<>Čă
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
Py7wkyXYf1YXvFvHuizOqva6WWWYEQ-JYv1rOAvWWaARLyGdQdxuW-iBf1Vwd8orZjqkcIGgnxOfuRsarXKmn4-3L2MRIZKPhhx2QRqpPRtFylEABH1KwZ_2ZZnx5cpcO8TIoeVdL6NXnRw-WrT06zTUzVRioNPRLPa0J6c8_eb5QFb4EG5wPpn-XlJSedjAw31MUNvFxKYQku_UwJF0CvvXLCozVnNM_dDNWsgBevzB8VBySbfW7XgYMRPJRlJe3Pjeues9tyGJvAxGJVjfo4nZyWusMF2G4f9w06m3Bxjc7ladgJR6F6pyI4Z65DCIL7G6G2y__agmNcKtFwCS_Q==
|
@ -0,0 +1 @@
|
||||
XRx7Nqxt_zuPNo7h8_j1LLVzqzIZg9qAYGRN9Iuq3XBc11Y7_RoQsg==
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user