diff options
author | Jakob Unterwurzacher | 2021-05-23 11:08:03 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-05-26 13:17:56 +0200 |
commit | 7d72baca69825a83487728e000596241f4ac88fe (patch) | |
tree | e589f6d5abdc117e9884aff84f775c21f12b4187 | |
parent | 1d2ac1e589209be96f8ee5fbba9a18e7e2c5fb04 (diff) |
tests: add TestHaveDotdot
As discovered by xfstests generic/401 [1], during the move to
the v2 api we seem to have lost the "." and ".." directory
entries.
[1]: https://github.com/rfjakob/fuse-xfstests/blob/4ef5b032bc283743d0eb58a8a28738766e664899/screenlog.0#L520
-rw-r--r-- | tests/matrix/dir_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/matrix/dir_test.go b/tests/matrix/dir_test.go index 2f9f1b0..2f7a034 100644 --- a/tests/matrix/dir_test.go +++ b/tests/matrix/dir_test.go @@ -3,6 +3,7 @@ package matrix import ( "fmt" "os" + "os/exec" "syscall" "testing" @@ -48,3 +49,24 @@ func TestRmdirPerms(t *testing.T) { } } } + +// TestHaveDotdot checks that we have "." and ".." in a directory. +// (gocryptfs v2.0-beta1 did not!) +func TestHaveDotdot(t *testing.T) { + dir1 := test_helpers.DefaultPlainDir + "/TestHaveDotdot" + err := os.Mkdir(dir1, 0700) + if err != nil { + t.Fatal(err) + } + // All Go readdir functions filter out "." and "..". + // Fall back to "ls -a" which does not. + out, err := exec.Command("ls", "-a", dir1).CombinedOutput() + if err != nil { + t.Fatal(err) + } + have := string(out) + want := ".\n..\n" + if have != want { + t.Errorf("have=%q want=%q", have, want) + } +} |