summaryrefslogtreecommitdiff
path: root/internal/syscallcompat/emulate_test.go
diff options
context:
space:
mode:
authorSebastian Lackner2019-01-14 02:45:21 +0100
committerrfjakob2019-01-14 21:27:28 +0100
commit0345cc08307c01da635ea5546952a584480c9a93 (patch)
treef5f6071c1d303e8eb1506c74f5f318768f5f9430 /internal/syscallcompat/emulate_test.go
parent229a9da74bc0839e2cd481f701c877708b080ede (diff)
syscallcompat: Drop Fchmodat emulation on macOS.
On macOS the function has a flags argument, so we don't need the /proc/self/fd trick used on Linux.
Diffstat (limited to 'internal/syscallcompat/emulate_test.go')
-rw-r--r--internal/syscallcompat/emulate_test.go53
1 files changed, 0 insertions, 53 deletions
diff --git a/internal/syscallcompat/emulate_test.go b/internal/syscallcompat/emulate_test.go
index 2747cc1..3f23d91 100644
--- a/internal/syscallcompat/emulate_test.go
+++ b/internal/syscallcompat/emulate_test.go
@@ -29,59 +29,6 @@ func TestEmulateMknodat(t *testing.T) {
}
}
-func TestEmulateFchmodat(t *testing.T) {
- fd, err := os.Create(tmpDir + "/chmod")
- if err != nil {
- t.Fatal(err)
- }
- err = fd.Chmod(0654)
- if err != nil {
- t.Fatal(err)
- }
- fd.Close()
- // Chmod a normal file
- err = emulateFchmodat(tmpDirFd, "chmod", 0600, 0)
- if err != nil {
- t.Fatal(err)
- }
- var st syscall.Stat_t
- err = syscall.Lstat(tmpDir+"/chmod", &st)
- if err != nil {
- t.Fatal(err)
- }
- if st.Mode != 0100600 {
- t.Fatalf("Wrong mode: have %o, want %o", st.Mode, 0100600)
- }
- // Chmod a symlink (original file should not change)
- err = os.Symlink(tmpDir+"/chmod", tmpDir+"/chmodSymlink")
- if err != nil {
- t.Fatal(err)
- }
- err = emulateFchmodat(tmpDirFd, "chmodSymlink", 0123, unix.AT_SYMLINK_NOFOLLOW)
- if err != nil {
- t.Fatal(err)
- }
- err = syscall.Lstat(tmpDir+"/chmod", &st)
- if err != nil {
- t.Fatal(err)
- }
- if st.Mode != 0100600 {
- t.Fatalf("Wrong mode: have %o, want %o", st.Mode, 0100600)
- }
- // Test with absolute path
- err = emulateFchmodat(-1, tmpDir+"/chmod", 0400, 0)
- if err != nil {
- t.Fatal(err)
- }
- err = syscall.Lstat(tmpDir+"/chmod", &st)
- if err != nil {
- t.Fatal(err)
- }
- if st.Mode != 0100400 {
- t.Fatalf("Wrong mode: have %o, want %o", st.Mode, 0100400)
- }
-}
-
func TestEmulateFchownat(t *testing.T) {
t.Skipf("TODO")
}