MacOS: fix TestEmulateSymlinkat test failure
On MacOS, symlinks don't have their own permissions, so don't check for them.
This commit is contained in:
parent
48d5f10c79
commit
90f2fea7fb
|
@ -2,6 +2,7 @@ package syscallcompat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -214,8 +215,16 @@ func TestEmulateSymlinkat(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if st.Mode != 0120777 {
|
if runtime.GOOS == "darwin" {
|
||||||
t.Fatalf("Wrong mode, have %o, want 0120777", st.Mode)
|
// 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
|
// Test with absolute path
|
||||||
err = emulateSymlinkat("/foo/bar/baz", -1, tmpDir+"/symlink2")
|
err = emulateSymlinkat("/foo/bar/baz", -1, tmpDir+"/symlink2")
|
||||||
|
|
Loading…
Reference in New Issue