aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-02-28 20:19:31 +0100
committerJakob Unterwurzacher2018-02-28 20:19:31 +0100
commit90f2fea7fba8cd2cab1c28471f955a99f91ca0ad (patch)
treed9de8c8ab89d5c8ce8c15d01b42c208bf42171a6 /internal/syscallcompat
parent48d5f10c791be37810ae3d880f84140a4122911c (diff)
MacOS: fix TestEmulateSymlinkat test failure
On MacOS, symlinks don't have their own permissions, so don't check for them.
Diffstat (limited to 'internal/syscallcompat')
-rw-r--r--internal/syscallcompat/emulate_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/syscallcompat/emulate_test.go b/internal/syscallcompat/emulate_test.go
index c259778..77fec5f 100644
--- a/internal/syscallcompat/emulate_test.go
+++ b/internal/syscallcompat/emulate_test.go
@@ -2,6 +2,7 @@ package syscallcompat
import (
"os"
+ "runtime"
"syscall"
"testing"
@@ -214,8 +215,16 @@ func TestEmulateSymlinkat(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if st.Mode != 0120777 {
- t.Fatalf("Wrong mode, have %o, want 0120777", st.Mode)
+ if runtime.GOOS == "darwin" {
+ // On MacOS, symlinks don't carry their own permissions, so
+ // only check the file type.
+ if st.Mode&syscall.S_IFMT != syscall.S_IFLNK {
+ t.Fatalf("This is not a symlink: mode = 0%o", st.Mode)
+ }
+ } else {
+ if st.Mode != 0120777 {
+ t.Fatalf("Wrong mode, have 0%o, want 0120777", st.Mode)
+ }
}
// Test with absolute path
err = emulateSymlinkat("/foo/bar/baz", -1, tmpDir+"/symlink2")