From 55a1ad42bd172aa235015b88c092a225ec7f4862 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 20 Oct 2022 13:21:41 -0400 Subject: tests: Add a helper for cleaning scratch And try to unmount things if the a test left them mounted. --- tests/posix/L_xdev.sh | 2 +- tests/posix/depth_error.sh | 4 ++-- tests/posix/type_bind_mount.sh | 2 +- tests/posix/xdev.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/posix') diff --git a/tests/posix/L_xdev.sh b/tests/posix/L_xdev.sh index f0ba120..c18a39e 100644 --- a/tests/posix/L_xdev.sh +++ b/tests/posix/L_xdev.sh @@ -1,7 +1,7 @@ skip_unless test "$SUDO" skip_if test "$UNAME" = "Darwin" -rm -rf scratch/* +clean_scratch mkdir scratch/{foo,mnt} sudo mount -t tmpfs tmpfs scratch/mnt ln -s ../mnt scratch/foo/bar diff --git a/tests/posix/depth_error.sh b/tests/posix/depth_error.sh index 9acf976..e1267f4 100644 --- a/tests/posix/depth_error.sh +++ b/tests/posix/depth_error.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch touchp scratch/foo/bar chmod a-r scratch/foo @@ -6,6 +6,6 @@ bfs_diff scratch -depth ret=$? chmod +r scratch/foo -rm -rf scratch/* +clean_scratch [ $ret -eq $EX_BFS ] diff --git a/tests/posix/type_bind_mount.sh b/tests/posix/type_bind_mount.sh index 87b1549..e05baa3 100644 --- a/tests/posix/type_bind_mount.sh +++ b/tests/posix/type_bind_mount.sh @@ -1,7 +1,7 @@ skip_unless test "$SUDO" skip_unless test "$UNAME" = "Linux" -rm -rf scratch/* +clean_scratch $TOUCH scratch/{file,null} sudo mount --bind /dev/null scratch/null diff --git a/tests/posix/xdev.sh b/tests/posix/xdev.sh index cbb3347..7c26c3f 100644 --- a/tests/posix/xdev.sh +++ b/tests/posix/xdev.sh @@ -1,7 +1,7 @@ skip_unless test "$SUDO" skip_if test "$UNAME" = "Darwin" -rm -rf scratch/* +clean_scratch mkdir scratch/{foo,mnt} sudo mount -t tmpfs tmpfs scratch/mnt $TOUCH scratch/foo/bar scratch/mnt/baz -- cgit v1.2.3