From: Dave Chinner <dchinner@xxxxxxxxxx> To match the cleanup of tests/xfs Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> --- tests/shared/002 | 7 ++++--- tests/shared/298 | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/shared/002 b/tests/shared/002 index d99539c9..0a92dcc2 100755 --- a/tests/shared/002 +++ b/tests/shared/002 @@ -15,12 +15,13 @@ . ./common/preamble _begin_fstest auto metadata quick log -# Override the default cleanup function. -_cleanup() +_dmflakey_cleanup() { + _unmount_flakey _cleanup_flakey - rm -f $tmp.* + _cleanup } +_register_cleanup _dmflakey_cleanup # Import common functions. . ./common/filter diff --git a/tests/shared/298 b/tests/shared/298 index bd52b6a0..797ac7a8 100755 --- a/tests/shared/298 +++ b/tests/shared/298 @@ -9,6 +9,17 @@ . ./common/preamble _begin_fstest auto trim +_loop_cleanup() +{ + UMOUNT_PROG $loop_dev &> /dev/null + _destroy_loop_device $loop_dev + if [ $status -eq 0 ]; then + rm $img_file + fi + _cleanup +} +_register_cleanup _loop_cleanup + _supported_fs ext4 xfs btrfs _require_test _require_loop @@ -27,17 +38,6 @@ fi [ "$FSTYP" = "btrfs" ] && _require_btrfs_command inspect-internal dump-super [ "$FSTYP" = "btrfs" ] && _require_btrfs_command inspect-internal dump-tree -# Override the default cleanup function. -_cleanup() -{ - $UMOUNT_PROG $loop_dev &> /dev/null - _destroy_loop_device $loop_dev - if [ $status -eq 0 ]; then - rm -rf $tmp - rm $img_file - fi -} - get_holes() { # It's not a good idea to be running tools against the image file -- 2.35.1