diff options
author | Sebastian Lackner | 2019-01-14 02:32:28 +0100 |
---|---|---|
committer | rfjakob | 2019-01-14 21:27:28 +0100 |
commit | da557702d713e38a8c6c4c28275724c70988f919 (patch) | |
tree | 615a8c9487b52c18d74bed29defd03d03c933743 /internal/syscallcompat/sys_common_test.go | |
parent | d7be76685128cb2cdca01becd856ea57cc18ef34 (diff) |
syscallcompat: Drop Openat emulation on macOS.
Diffstat (limited to 'internal/syscallcompat/sys_common_test.go')
-rw-r--r-- | internal/syscallcompat/sys_common_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_common_test.go b/internal/syscallcompat/sys_common_test.go index 455774f..db6719e 100644 --- a/internal/syscallcompat/sys_common_test.go +++ b/internal/syscallcompat/sys_common_test.go @@ -34,6 +34,35 @@ func TestReadlinkat(t *testing.T) { } } +func TestOpenat(t *testing.T) { + _, err := Openat(tmpDirFd, "testOpenAt", 0, 0) + if err == nil { + t.Errorf("should have failed") + } + fd, err := os.Create(tmpDir + "/testOpenAt") + if err != nil { + t.Fatal(err) + } + fd.Close() + rawFd, err := Openat(tmpDirFd, "testOpenAt", 0, 0) + if err != nil { + t.Fatal(err) + } + defer syscall.Close(rawFd) + if rawFd < 0 { + t.Fatalf("rawFd=%d", rawFd) + } + // Test with absolute path + rawFd, err = Openat(-1, tmpDir+"/testOpenAt", 0, 0) + if err != nil { + t.Fatal(err) + } + defer syscall.Close(rawFd) + if rawFd < 0 { + t.Fatalf("rawFd=%d", rawFd) + } +} + func TestFchmodat(t *testing.T) { regular := "TestFchmodat_Regular" f, err := os.OpenFile(tmpDir+"/"+regular, os.O_CREATE|os.O_WRONLY, 0000) |