aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/syscallcompat/sys_common_test.go')
-rw-r--r--internal/syscallcompat/sys_common_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_common_test.go b/internal/syscallcompat/sys_common_test.go
index 78283e6..e1c7b24 100644
--- a/internal/syscallcompat/sys_common_test.go
+++ b/internal/syscallcompat/sys_common_test.go
@@ -247,3 +247,29 @@ func TestSymlinkat(t *testing.T) {
}
symlinkCheckMode(t, st)
}
+
+func TestMkdirat(t *testing.T) {
+ err := Mkdirat(tmpDirFd, "mkdirat", 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fi, err := os.Stat(tmpDir + "/mkdirat")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !fi.IsDir() {
+ t.Fatalf("mkdirat did not create a directory")
+ }
+ // Test with absolute path
+ err = Mkdirat(-1, tmpDir+"/mkdirat2", 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fi, err = os.Stat(tmpDir + "/mkdirat2")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !fi.IsDir() {
+ t.Fatalf("mkdirat did not create a directory")
+ }
+}