diff options
author | Sebastian Lackner | 2019-01-14 02:51:50 +0100 |
---|---|---|
committer | rfjakob | 2019-01-14 21:27:28 +0100 |
commit | 7b0d56fe98a4ae449d26af0b83d00271a179db6e (patch) | |
tree | 64c4d65ac92ba86949ad3376e47a1292953044ae /internal/syscallcompat/emulate_test.go | |
parent | 92110628ee5f48b0106b32090854fcc61d6bca20 (diff) |
syscallcompat: Drop Symlinkat emulation on macOS.
Diffstat (limited to 'internal/syscallcompat/emulate_test.go')
-rw-r--r-- | internal/syscallcompat/emulate_test.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/internal/syscallcompat/emulate_test.go b/internal/syscallcompat/emulate_test.go index 6fe5f3e..6db37f8 100644 --- a/internal/syscallcompat/emulate_test.go +++ b/internal/syscallcompat/emulate_test.go @@ -2,8 +2,6 @@ package syscallcompat import ( "os" - "runtime" - "syscall" "testing" "golang.org/x/sys/unix" @@ -29,45 +27,6 @@ func TestEmulateMknodat(t *testing.T) { } } -// symlinkCheckMode looks if the mode bits in "st" say that this is a symlink. -// Calls t.Fatal() if not. -func symlinkCheckMode(t *testing.T, st syscall.Stat_t) { - 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) - } - return - } - if st.Mode != 0120777 { - t.Fatalf("Wrong mode, have 0%o, want 0120777", st.Mode) - } -} - -func TestEmulateSymlinkat(t *testing.T) { - err := emulateSymlinkat("/foo/bar/baz", tmpDirFd, "symlink1") - if err != nil { - t.Fatal(err) - } - var st syscall.Stat_t - err = syscall.Lstat(tmpDir+"/symlink1", &st) - if err != nil { - t.Fatal(err) - } - symlinkCheckMode(t, st) - // Test with absolute path - err = emulateSymlinkat("/foo/bar/baz", -1, tmpDir+"/symlink2") - if err != nil { - t.Fatal(err) - } - err = syscall.Lstat(tmpDir+"/symlink2", &st) - if err != nil { - t.Fatal(err) - } - symlinkCheckMode(t, st) -} - func TestEmulateMkdirat(t *testing.T) { err := emulateMkdirat(tmpDirFd, "mkdirat", 0700) if err != nil { |