summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-08-28 11:02:28 +0200
committerJakob Unterwurzacher2022-08-28 11:07:35 +0200
commitbf29c9f99d90343d608c86b536c36abece158591 (patch)
treea3d2d23bb245d213c504b5dd99dcca7f83c540b5 /tests
parent5582d8370cce68bbad1f7e44f1fdc52fdc9d9d71 (diff)
tests: add TestLongnamemax100Reverse
Fails right now as reported in https://github.com/rfjakob/gocryptfs/pull/655 --- FAIL: TestLongnamemax100Reverse (0.09s) longnamemax_test.go:104: l=64: should see a longname now longnamemax_test.go:104: l=65: should see a longname now longnamemax_test.go:104: l=66: should see a longname now longnamemax_test.go:104: l=67: should see a longname now longnamemax_test.go:104: l=68: should see a longname now longnamemax_test.go:104: l=69: should see a longname now longnamemax_test.go:104: l=70: should see a longname now longnamemax_test.go:104: l=71: should see a longname now longnamemax_test.go:104: l=72: should see a longname now longnamemax_test.go:104: l=73: should see a longname now longnamemax_test.go:104: l=74: should see a longname now longnamemax_test.go:104: l=75: should see a longname now longnamemax_test.go:104: l=76: should see a longname now longnamemax_test.go:104: l=77: should see a longname now longnamemax_test.go:104: l=78: should see a longname now longnamemax_test.go:104: l=79: should see a longname now longnamemax_test.go:104: l=80: should see a longname now longnamemax_test.go:104: l=81: should see a longname now longnamemax_test.go:104: l=82: should see a longname now longnamemax_test.go:104: l=83: should see a longname now longnamemax_test.go:104: l=84: should see a longname now longnamemax_test.go:104: l=85: should see a longname now longnamemax_test.go:104: l=86: should see a longname now longnamemax_test.go:104: l=87: should see a longname now longnamemax_test.go:104: l=88: should see a longname now longnamemax_test.go:104: l=89: should see a longname now longnamemax_test.go:104: l=90: should see a longname now longnamemax_test.go:104: l=91: should see a longname now longnamemax_test.go:104: l=92: should see a longname now longnamemax_test.go:104: l=93: should see a longname now longnamemax_test.go:104: l=94: should see a longname now longnamemax_test.go:104: l=95: should see a longname now longnamemax_test.go:104: l=96: should see a longname now longnamemax_test.go:104: l=97: should see a longname now longnamemax_test.go:104: l=98: should see a longname now longnamemax_test.go:104: l=99: should see a longname now longnamemax_test.go:104: l=100: should see a longname now longnamemax_test.go:104: l=101: should see a longname now longnamemax_test.go:104: l=102: should see a longname now longnamemax_test.go:104: l=103: should see a longname now longnamemax_test.go:104: l=104: should see a longname now longnamemax_test.go:104: l=105: should see a longname now longnamemax_test.go:104: l=106: should see a longname now longnamemax_test.go:104: l=107: should see a longname now longnamemax_test.go:104: l=108: should see a longname now longnamemax_test.go:104: l=109: should see a longname now longnamemax_test.go:104: l=110: should see a longname now longnamemax_test.go:104: l=111: should see a longname now longnamemax_test.go:104: l=112: should see a longname now longnamemax_test.go:104: l=113: should see a longname now longnamemax_test.go:104: l=114: should see a longname now longnamemax_test.go:104: l=115: should see a longname now longnamemax_test.go:104: l=116: should see a longname now longnamemax_test.go:104: l=117: should see a longname now longnamemax_test.go:104: l=118: should see a longname now longnamemax_test.go:104: l=119: should see a longname now longnamemax_test.go:104: l=120: should see a longname now longnamemax_test.go:104: l=121: should see a longname now longnamemax_test.go:104: l=122: should see a longname now longnamemax_test.go:104: l=123: should see a longname now longnamemax_test.go:104: l=124: should see a longname now longnamemax_test.go:104: l=125: should see a longname now longnamemax_test.go:104: l=126: should see a longname now longnamemax_test.go:104: l=127: should see a longname now longnamemax_test.go:104: l=128: should see a longname now longnamemax_test.go:104: l=129: should see a longname now longnamemax_test.go:104: l=130: should see a longname now longnamemax_test.go:104: l=131: should see a longname now longnamemax_test.go:104: l=132: should see a longname now longnamemax_test.go:104: l=133: should see a longname now longnamemax_test.go:104: l=134: should see a longname now longnamemax_test.go:104: l=135: should see a longname now longnamemax_test.go:104: l=136: should see a longname now longnamemax_test.go:104: l=137: should see a longname now longnamemax_test.go:104: l=138: should see a longname now longnamemax_test.go:104: l=139: should see a longname now longnamemax_test.go:104: l=140: should see a longname now longnamemax_test.go:104: l=141: should see a longname now longnamemax_test.go:104: l=142: should see a longname now longnamemax_test.go:104: l=143: should see a longname now longnamemax_test.go:104: l=144: should see a longname now longnamemax_test.go:104: l=145: should see a longname now longnamemax_test.go:104: l=146: should see a longname now longnamemax_test.go:104: l=147: should see a longname now longnamemax_test.go:104: l=148: should see a longname now longnamemax_test.go:104: l=149: should see a longname now longnamemax_test.go:104: l=150: should see a longname now longnamemax_test.go:104: l=151: should see a longname now longnamemax_test.go:104: l=152: should see a longname now longnamemax_test.go:104: l=153: should see a longname now longnamemax_test.go:104: l=154: should see a longname now longnamemax_test.go:104: l=155: should see a longname now longnamemax_test.go:104: l=156: should see a longname now longnamemax_test.go:104: l=157: should see a longname now longnamemax_test.go:104: l=158: should see a longname now longnamemax_test.go:104: l=159: should see a longname now longnamemax_test.go:104: l=160: should see a longname now longnamemax_test.go:104: l=161: should see a longname now longnamemax_test.go:104: l=162: should see a longname now longnamemax_test.go:104: l=163: should see a longname now longnamemax_test.go:104: l=164: should see a longname now longnamemax_test.go:104: l=165: should see a longname now longnamemax_test.go:104: l=166: should see a longname now longnamemax_test.go:104: l=167: should see a longname now longnamemax_test.go:104: l=168: should see a longname now longnamemax_test.go:104: l=169: should see a longname now longnamemax_test.go:104: l=170: should see a longname now longnamemax_test.go:104: l=171: should see a longname now longnamemax_test.go:104: l=172: should see a longname now longnamemax_test.go:104: l=173: should see a longname now longnamemax_test.go:104: l=174: should see a longname now longnamemax_test.go:104: l=175: should see a longname now FAIL https://github.com/rfjakob/gocryptfs/pull/655
Diffstat (limited to 'tests')
-rw-r--r--tests/cli/longnamemax_test.go48
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/cli/longnamemax_test.go b/tests/cli/longnamemax_test.go
index fc429f6..e44a84e 100644
--- a/tests/cli/longnamemax_test.go
+++ b/tests/cli/longnamemax_test.go
@@ -16,7 +16,7 @@ import (
// Create & test fs with -longnamemax=100
func TestLongnamemax100(t *testing.T) {
- cDir := test_helpers.InitFS(nil, "-longnamemax", "100")
+ cDir := test_helpers.InitFS(t, "-longnamemax", "100")
pDir := cDir + ".mnt"
// Check config file sanity
@@ -59,3 +59,49 @@ func TestLongnamemax100(t *testing.T) {
}
}
}
+
+// Create & test fs with -reverse -longnamemax=100
+func TestLongnamemax100Reverse(t *testing.T) {
+ backingDir := test_helpers.InitFS(t, "-reverse", "-longnamemax", "100")
+ mntDir := backingDir + ".mnt"
+
+ // Check config file sanity
+ _, c, err := configfile.LoadAndDecrypt(backingDir+"/"+configfile.ConfReverseName, testPw)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ if !c.IsFeatureFlagSet(configfile.FlagLongNameMax) {
+ t.Error("FlagLongNameMax should be on")
+ }
+ if c.LongNameMax != 100 {
+ t.Errorf("LongNameMax=%d, want 100", c.LongNameMax)
+ }
+
+ // Check that it takes effect
+ test_helpers.MountOrExit(backingDir, mntDir, "-reverse", "-extpass", "echo test")
+ defer test_helpers.UnmountPanic(mntDir)
+
+ for l := 1; l <= 255; l++ {
+ path := backingDir + "/" + strings.Repeat("x", l)
+ if err := ioutil.WriteFile(path, nil, 0600); err != nil {
+ t.Fatal(err)
+ }
+ matches, err := filepath.Glob(mntDir + "/gocryptfs.longname.*")
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = syscall.Unlink(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // As determined experimentally, a name of length >= 64 causes a longname
+ // to be created.
+ if l <= 63 && len(matches) != 0 {
+ t.Errorf("l=%d: should not see a longname yet", l)
+ }
+ if l >= 64 && len(matches) != 2 {
+ t.Errorf("l=%d: should see a longname now", l)
+ }
+ }
+}