check: remove require_{test,scratch}* after a test fails
PATCH 1/2 check: remove require_{test,scratch}* after a test fails
From: Darrick J. Wong <[email protected]>
Remove the require_{test,scratch]* sentinel files after a test fails. This eliminates false fsck corruption reports such as the following:
1. Test A calls _require_scratch, which creates the sentinel file $RESULT_DIR/require_scratch to facilitate fsck after the test completes.
2. Test A runs some test, which corrupts the scratch filesystem due to kernel bug or something.
3. Test A calls _fail because of the errors in (2). Note that the test case returned 1, so ./check unmounts the test and scratch filesystems without checking them or removing $RESULT_DIR/require_scratch
4. Test B starts up, but does not call _require_scratch. The $RESULT_DIR/require_scratch file is still there.
5. Test B completes successfully.
6. ./check calls _check_filesystems, which sees the $RESULT_DIR/require_scratch file and runs fsck.
7. fsck reports the corrupt scratch device (which is associated with test B) even though B did not ever touch the scratch device and it was actually test A that corrupted the filesystem.
Note that with the "check: wipe scratch devices between tests" patch applied, we can also reproduce this problem by running xfs/172 and xfs/195 with a scratch device small enough that the files created in 172 span multiple AGs and therefore cause 172 to fail.
--- check | 2 ++ 1 file changed, 2 insertions(+)
check +2 -0
@@ -788,6 +788,8 @@ for section in $HOST_OPTIONS_SECTIONS; do _dump_err_cont "[failed, exit status $sts]" _test_unmount 2> /dev/null _scratch_unmount 2> /dev/null + rm -f ${RESULT_DIR}/require_test* + rm -f ${RESULT_DIR}/require_scratch* err=true else # the test apparently passed, so check for corruption
PATCH 2/2 check: wipe scratch devices between tests
From: Darrick J. Wong <[email protected]>
Wipe the scratch devices in between each test to ensure that tests are formatting them and not making assumptions about previous contents.
--- check | 6 ++++-- common/rc | 9 +++++++++ common/xfs | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
check +4 -2
@@ -493,9 +493,8 @@ _check_filesystems() if [ -f ${RESULT_DIR}/require_scratch ]; then _check_scratch_fs || err=true rm -f ${RESULT_DIR}/require_scratch* - else - _scratch_unmount 2> /dev/null fi + _scratch_unmount 2> /dev/null } _expunge_test()
@@ -635,6 +634,8 @@ for section in $HOST_OPTIONS_SECTIONS; do echo "check: failed to mount \$SCRATCH_DEV using specified options" status=1 exit + else + _scratch_unmount fi fi
@@ -753,6 +754,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
common/rc +9 -0
@@ -3991,6 +3991,15 @@ _require_fibmap() rm -f $file } +_try_wipe_scratch_devs() +{ + test -x "$WIPEFS_PROG" || return 0 + + for dev in $SCRATCH_DEV_POOL $SCRATCH_DEV $SCRATCH_LOGDEV $SCRATCH_RTDEV; do + test -b $dev && $WIPEFS_PROG -a $dev + done +} + init_rc ################################################################################
common/xfs +1 -0
@@ -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" }
[PATCH 3/2] check: filter lockdep bugs when scanning dmesg
In reply to Darrick J. WongFrom: Darrick J. Wong <[email protected]>
Ignore lockdep complaining about its own bugginess when scanning dmesg output, because we shouldn't be failing filesystem tests on account of lockdep.
--- common/rc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
common/rc +8 -1
@@ -3511,6 +3511,13 @@ _check_dmesg_for() _dmesg_since_test_start | egrep -q "$1" } +# Default filter for dmesg scanning +_check_dmesg_filter() +{ + egrep -v -e "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low" \ + -e "BUG: MAX_STACK_TRACE_ENTRIES too low" +} + # check dmesg log for WARNING/Oops/etc. _check_dmesg() {
@@ -3522,7 +3529,7 @@ _check_dmesg() # default filter is a simple cat command, caller could provide a # customized filter and pass the name through the first argument, to # filter out intentional WARNINGs or Oopses - local filter=${1:-cat} + local filter=${1:-_check_dmesg_filter} _dmesg_since_test_start | $filter >$seqres.dmesg egrep -q -e "kernel BUG at" \