aboutsummaryrefslogtreecommitdiff
path: root/tests/matrix
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-01-20 14:32:59 +0100
committerJakob Unterwurzacher2019-01-20 14:32:59 +0100
commitec4c9f2adb7bf1edde43a981dc690d3fee6175e8 (patch)
treed47da0fdcccabab2c06422564a2a7acd82ff9870 /tests/matrix
parent962c52364415496b64a42b49fe5f90d593dc09f7 (diff)
tests: check that we can delete directories with all permission
Regression test for https://github.com/rfjakob/gocryptfs/issues/354
Diffstat (limited to 'tests/matrix')
-rw-r--r--tests/matrix/dir_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/matrix/dir_test.go b/tests/matrix/dir_test.go
index e7a0b22..2f9f1b0 100644
--- a/tests/matrix/dir_test.go
+++ b/tests/matrix/dir_test.go
@@ -1,6 +1,7 @@
package matrix
import (
+ "fmt"
"os"
"syscall"
"testing"
@@ -30,3 +31,20 @@ func TestDirOverwrite(t *testing.T) {
t.Fatal(err)
}
}
+
+// Test that we can create and remove a directory regardless of the permission it has
+// https://github.com/rfjakob/gocryptfs/issues/354
+func TestRmdirPerms(t *testing.T) {
+ for _, perm := range []uint32{0000, 0100, 0200, 0300, 0400, 0500, 0600, 0700} {
+ dir := fmt.Sprintf("TestRmdir%#o", perm)
+ path := test_helpers.DefaultPlainDir + "/" + dir
+ err := syscall.Mkdir(path, perm)
+ if err != nil {
+ t.Fatalf("Mkdir %q: %v", dir, err)
+ }
+ err = syscall.Rmdir(path)
+ if err != nil {
+ t.Fatalf("Rmdir %q: %v", dir, err)
+ }
+ }
+}