summaryrefslogtreecommitdiff
path: root/internal/syscallcompat/emulate_test.go
diff options
context:
space:
mode:
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 {