From 4732e33a9a39935ecc07dfb7e857cc05b6fc6045 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 5 Mar 2018 23:40:08 +0100 Subject: [PATCH] macos: tests: fix deleting of scratch dir macos rm does not understand --one-file-system, and it cannot handle unreadable directories. --- internal/syscallcompat/emulate_test.go | 4 ++-- test.bash | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/syscallcompat/emulate_test.go b/internal/syscallcompat/emulate_test.go index ddb012e..2cf2698 100644 --- a/internal/syscallcompat/emulate_test.go +++ b/internal/syscallcompat/emulate_test.go @@ -245,7 +245,7 @@ func TestEmulateSymlinkat(t *testing.T) { } func TestEmulateMkdirat(t *testing.T) { - err := emulateMkdirat(tmpDirFd, "mkdirat", 0100) + err := emulateMkdirat(tmpDirFd, "mkdirat", 0700) if err != nil { t.Fatal(err) } @@ -257,7 +257,7 @@ func TestEmulateMkdirat(t *testing.T) { t.Fatalf("mkdirat did not create a directory") } // Test with absolute path - err = emulateMkdirat(-1, tmpDir+"/mkdirat2", 0100) + err = emulateMkdirat(-1, tmpDir+"/mkdirat2", 0700) if err != nil { t.Fatal(err) } diff --git a/test.bash b/test.bash index 182cdc3..501804c 100755 --- a/test.bash +++ b/test.bash @@ -49,7 +49,12 @@ go test -count 1 ./... "$@" 200>&- # The tests cannot to this themselves as they are run in parallel. # Don't descend into possibly still mounted example filesystems. -rm -Rf --one-file-system $TESTDIR +if [[ $OSTYPE == *linux* ]] ; then + rm -Rf --one-file-system $TESTDIR +else + # MacOS "rm" does not understand "--one-file-system" + rm -Rf $TESTDIR +fi if grep -R "panic(" internal ; then echo "Please use log.Panic instead of naked panic!"