aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/emulate_test.go
diff options
context:
space:
mode:
authorSebastian Lackner2019-01-14 02:38:34 +0100
committerrfjakob2019-01-14 21:27:28 +0100
commit229a9da74bc0839e2cd481f701c877708b080ede (patch)
treea1eed605271537ce53b76038b51bc0decf9ddf0b /internal/syscallcompat/emulate_test.go
parent42bf6d1c68700a0d5d910c1be42088cc14125fec (diff)
syscallcompat: Drop Unlinkat emulation on macOS.
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 7d34c0c..2747cc1 100644
--- a/internal/syscallcompat/emulate_test.go
+++ b/internal/syscallcompat/emulate_test.go
@@ -9,59 +9,6 @@ import (
"golang.org/x/sys/unix"
)
-func TestEmulateUnlinkat(t *testing.T) {
- os.Mkdir(tmpDir+"/unlink1", 0700)
- dirfd, err := os.Open(tmpDir + "/unlink1")
- if err != nil {
- t.Fatal(err)
- }
- defer dirfd.Close()
- // Try to delete file
- fd, err := os.Create(tmpDir + "/unlink1/f1")
- if err != nil {
- t.Fatal(err)
- }
- fd.Close()
- err = emulateUnlinkat(int(dirfd.Fd()), "f1", 0)
- if err != nil {
- t.Fatal(err)
- }
- _, err = os.Stat(tmpDir + "/unlink1/f1")
- if err == nil {
- t.Fatalf("file not deleted!")
- }
- // Try to delete dir
- err = os.Mkdir(tmpDir+"/unlink1/d1", 0700)
- if err != nil {
- t.Fatal(err)
- }
- err = emulateUnlinkat(int(dirfd.Fd()), "d1", 0)
- if err == nil {
- t.Fatalf("this should fail due to missing AT_REMOVEDIR flag")
- }
- err = emulateUnlinkat(int(dirfd.Fd()), "d1", unix.AT_REMOVEDIR)
- if err != nil {
- t.Fatal(err)
- }
- _, err = os.Stat(tmpDir + "/unlink1/d1")
- if err == nil {
- t.Fatalf("dir not deleted!")
- }
- // Test with absolute path
- err = os.Mkdir(tmpDir+"/unlink1/d1", 0700)
- if err != nil {
- t.Fatal(err)
- }
- err = emulateUnlinkat(-1, tmpDir+"/unlink1/d1", unix.AT_REMOVEDIR)
- if err != nil {
- t.Fatal(err)
- }
- _, err = os.Stat(tmpDir + "/unlink1/d1")
- if err == nil {
- t.Fatalf("dir not deleted!")
- }
-}
-
func TestEmulateMknodat(t *testing.T) {
err := emulateMknodat(tmpDirFd, "fifo1", unix.S_IFIFO, 0)
if err != nil {