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/common/L_mount.sh | 2 +- tests/common/delete.sh | 2 +- tests/common/delete_many.sh | 2 +- tests/common/execdir_ulimit.sh | 2 +- tests/common/inum_bind_mount.sh | 2 +- tests/common/inum_mount.sh | 2 +- tests/common/mount.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/common') diff --git a/tests/common/L_mount.sh b/tests/common/L_mount.sh index d43f95a..d9e1dec 100644 --- a/tests/common/L_mount.sh +++ b/tests/common/L_mount.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/common/delete.sh b/tests/common/delete.sh index 4855d60..3709897 100644 --- a/tests/common/delete.sh +++ b/tests/common/delete.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch touchp scratch/foo/bar/baz # Don't try to delete '.' diff --git a/tests/common/delete_many.sh b/tests/common/delete_many.sh index 6446f93..6f54825 100644 --- a/tests/common/delete_many.sh +++ b/tests/common/delete_many.sh @@ -1,6 +1,6 @@ # Test for https://github.com/tavianator/bfs/issues/67 -rm -rf scratch/* +clean_scratch mkdir scratch/foo $TOUCH scratch/foo/{1..256} diff --git a/tests/common/execdir_ulimit.sh b/tests/common/execdir_ulimit.sh index 6da8783..8bd9edd 100644 --- a/tests/common/execdir_ulimit.sh +++ b/tests/common/execdir_ulimit.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch mkdir -p scratch/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z mkdir -p scratch/a/b/c/d/e/f/g/h/i/j/k/l/m/0/1/2/3/4/5/6/7/8/9/A/B/C diff --git a/tests/common/inum_bind_mount.sh b/tests/common/inum_bind_mount.sh index 654e762..8b1ac0e 100644 --- a/tests/common/inum_bind_mount.sh +++ b/tests/common/inum_bind_mount.sh @@ -1,7 +1,7 @@ skip_unless test "$SUDO" skip_unless test "$UNAME" = "Linux" -rm -rf scratch/* +clean_scratch $TOUCH scratch/{foo,bar} sudo mount --bind scratch/{foo,bar} diff --git a/tests/common/inum_mount.sh b/tests/common/inum_mount.sh index 8f5c317..f9f4e2b 100644 --- a/tests/common/inum_mount.sh +++ b/tests/common/inum_mount.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 diff --git a/tests/common/mount.sh b/tests/common/mount.sh index 6e20d90..6131ad4 100644 --- a/tests/common/mount.sh +++ b/tests/common/mount.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