diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-10-20 13:21:41 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-10-20 13:21:41 -0400 |
commit | 55a1ad42bd172aa235015b88c092a225ec7f4862 (patch) | |
tree | ffe5cc53024ee1a8c9a7c7029671bae7852025c9 /tests/gnu | |
parent | 4ec966263444dfae8837cd73b980cfdb9aabd93f (diff) | |
download | bfs-55a1ad42bd172aa235015b88c092a225ec7f4862.tar.xz |
tests: Add a helper for cleaning scratch
And try to unmount things if the a test left them mounted.
Diffstat (limited to 'tests/gnu')
-rw-r--r-- | tests/gnu/L_delete.sh | 2 | ||||
-rw-r--r-- | tests/gnu/ignore_readdir_race.sh | 2 | ||||
-rw-r--r-- | tests/gnu/ignore_readdir_race_notdir.sh | 2 | ||||
-rw-r--r-- | tests/gnu/inum_automount.sh | 2 | ||||
-rw-r--r-- | tests/gnu/printf_Y_error.sh | 4 | ||||
-rw-r--r-- | tests/gnu/regex_invalid_utf8.sh | 2 | ||||
-rw-r--r-- | tests/gnu/xtype_bind_mount.sh | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/tests/gnu/L_delete.sh b/tests/gnu/L_delete.sh index 08f39af..6ec167c 100644 --- a/tests/gnu/L_delete.sh +++ b/tests/gnu/L_delete.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch mkdir scratch/foo mkdir scratch/bar ln -s ../foo scratch/bar/baz diff --git a/tests/gnu/ignore_readdir_race.sh b/tests/gnu/ignore_readdir_race.sh index 429933c..547253b 100644 --- a/tests/gnu/ignore_readdir_race.sh +++ b/tests/gnu/ignore_readdir_race.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch $TOUCH scratch/{foo,bar} # -links 1 forces a stat() call, which will fail for the second file diff --git a/tests/gnu/ignore_readdir_race_notdir.sh b/tests/gnu/ignore_readdir_race_notdir.sh index 0c3ff5d..91a383b 100644 --- a/tests/gnu/ignore_readdir_race_notdir.sh +++ b/tests/gnu/ignore_readdir_race_notdir.sh @@ -1,5 +1,5 @@ # Check -ignore_readdir_race handling when a directory is replaced with a file -rm -rf scratch/* +clean_scratch touchp scratch/foo/bar invoke_bfs scratch -mindepth 1 -ignore_readdir_race -execdir rm -r {} \; -execdir $TOUCH {} \; diff --git a/tests/gnu/inum_automount.sh b/tests/gnu/inum_automount.sh index 0149043..82f85d2 100644 --- a/tests/gnu/inum_automount.sh +++ b/tests/gnu/inum_automount.sh @@ -3,7 +3,7 @@ skip_unless test "$SUDO" skip_unless command -v systemd-mount &>/dev/null -rm -rf scratch/* +clean_scratch mkdir scratch/{foo,mnt} skip_unless sudo systemd-mount -A -o bind basic scratch/mnt diff --git a/tests/gnu/printf_Y_error.sh b/tests/gnu/printf_Y_error.sh index 933c734..6487711 100644 --- a/tests/gnu/printf_Y_error.sh +++ b/tests/gnu/printf_Y_error.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch mkdir scratch/foo chmod -x scratch/foo ln -s foo/bar scratch/bar @@ -7,6 +7,6 @@ bfs_diff scratch -printf '(%p) (%l) %y %Y\n' ret=$? chmod +x scratch/foo -rm -rf scratch/* +clean_scratch [ $ret -eq $EX_BFS ] diff --git a/tests/gnu/regex_invalid_utf8.sh b/tests/gnu/regex_invalid_utf8.sh index 85f1897..edb4b1e 100644 --- a/tests/gnu/regex_invalid_utf8.sh +++ b/tests/gnu/regex_invalid_utf8.sh @@ -1,4 +1,4 @@ -rm -rf scratch/* +clean_scratch # Incomplete UTF-8 sequences skip_unless touch scratch/$'\xC3' diff --git a/tests/gnu/xtype_bind_mount.sh b/tests/gnu/xtype_bind_mount.sh index 56f9c5c..d371cd5 100644 --- a/tests/gnu/xtype_bind_mount.sh +++ b/tests/gnu/xtype_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 ln -s /dev/null scratch/link |