Skip to content

Commit

Permalink
macos: tests: fix deleting of scratch dir
Browse files Browse the repository at this point in the history
macos rm does not understand --one-file-system,
and it cannot handle unreadable directories.
  • Loading branch information
rfjakob committed Mar 5, 2018
1 parent 18d4159 commit 4732e33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/syscallcompat/emulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
7 changes: 6 additions & 1 deletion test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down

0 comments on commit 4732e33

Please sign in to comment.