From 7d72baca69825a83487728e000596241f4ac88fe Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 23 May 2021 11:08:03 +0200 Subject: 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 --- tests/matrix/dir_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') 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) + } +} -- cgit v1.2.3