summaryrefslogtreecommitdiff
path: root/tests/reverse/correctness_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-02-16 21:20:29 +0100
committerJakob Unterwurzacher2017-02-16 21:20:29 +0100
commit62e7eb7d04793d7d629c1105a3eddf04e396ac24 (patch)
treec3589273e1ccd86553ea361f42c61cda3e4e63fd /tests/reverse/correctness_test.go
parent45c1ea499ee7f1f4309f1f8aa8b78c16642662db (diff)
tests: reverse: check Access() call
Diffstat (limited to 'tests/reverse/correctness_test.go')
-rw-r--r--tests/reverse/correctness_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/reverse/correctness_test.go b/tests/reverse/correctness_test.go
index 3565ea6..db64983 100644
--- a/tests/reverse/correctness_test.go
+++ b/tests/reverse/correctness_test.go
@@ -3,6 +3,7 @@ package reverse_test
import (
"io/ioutil"
"os"
+ "syscall"
"testing"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
@@ -65,3 +66,26 @@ func TestConfigMapping(t *testing.T) {
t.Errorf("empty file")
}
}
+
+// Check that the access() syscall works on virtual files
+func TestAccessVirtual(t *testing.T) {
+ if plaintextnames {
+ t.Skip()
+ }
+ var R_OK uint32 = 4
+ var W_OK uint32 = 2
+ var X_OK uint32 = 1
+ fn := dirB + "/gocryptfs.diriv"
+ err := syscall.Access(fn, R_OK)
+ if err != nil {
+ t.Errorf("%q should be readable, but got error: %v", fn, err)
+ }
+ err = syscall.Access(fn, W_OK)
+ if err == nil {
+ t.Errorf("should NOT be writeable")
+ }
+ err = syscall.Access(fn, X_OK)
+ if err == nil {
+ t.Errorf("should NOT be executable")
+ }
+}