[PATCH 11/12] check: wipe scratch devices between tests

Darrick J. Wong
2019-03-20T00:45:58Z

Wipe the scratch devices in between each test to ensure that tests are
formatting them and not making assumptions about previous contents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
check | 1 +
common/rc | 6 ++++++
common/xfs | 1 +
3 files changed, 8 insertions(+)

diff --git a/check b/check
index a2c5ba21..bcf08dfe 100755
--- a/check
+++ b/check
@@ -737,6 +737,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
# _check_dmesg depends on this log in dmesg
touch ${RESULT_DIR}/check_dmesg
fi
+ _try_wipe_scratch_devs > /dev/null 2>&1
if [ "$DUMP_OUTPUT" = true ]; then
./$seq 2>&1 | tee $tmp.out
# Because $? would get tee's return code
diff --git a/common/rc b/common/rc
index 1c42515f..40eef80f 100644
--- a/common/rc
+++ b/common/rc
@@ -3942,6 +3942,12 @@ _require_fibmap()
rm -f $file
}

+_try_wipe_scratch_devs()
+{
+ _scratch_unmount
+ test -x "$WIPEFS_PROG" && $WIPEFS_PROG -a $SCRATCH_DEV_POOL $SCRATCH_DEV $SCRATCH_LOGDEV $SCRATCH_RTDEV
+}
+
init_rc

################################################################################
diff --git a/common/xfs b/common/xfs
index 24065813..af2b62ba 100644
--- a/common/xfs
+++ b/common/xfs
@@ -295,6 +295,7 @@ _require_xfs_db_command()
fi
command=$1

+ _scratch_mkfs_xfs >/dev/null 2>&1
_scratch_xfs_db -x -c "help" | grep $command > /dev/null || \
_notrun "xfs_db $command support is missing"
}