common: Add _require_no_xfs_bug_on_assert and factor out filter_xfs_dmesg

1) Introduce _require_no_xfs_bug_on_assert helper to check if XFS is
   built with CONFIG_XFS_ASSERT_FATAL, and call _require_no_xfs_debug
   if bug_on_assert is not available.

2) Apply _require_no_xfs_bug_on_assert in xfs/098 and xfs/115.

3) Move filter_xfs_dmesg from xfs/098 to common/filter, and rename
   it as _filter_assert_dmesg.

[eguan: update comment and _notrun message a bit]

Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
xiao yang
2018-01-19 13:38:05 +08:00
committed by Eryu Guan
parent 21e7398203
commit a3b3cf68fb
4 changed files with 41 additions and 15 deletions
+6 -12
View File
@@ -47,6 +47,8 @@ _cleanup()
_supported_fs xfs
_supported_os Linux
# We corrupt XFS on purpose, and check if assert failures would crash system.
_require_no_xfs_bug_on_assert
_require_scratch
test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
_require_attrs
@@ -56,16 +58,6 @@ test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
rm -f $seqres.full
# If we corrupt log on a CONFIG_XFS_WARN build, there will be mount related
# WARNINGs in dmesg as expected. We don't want to simply _disable_dmesg_check
# which could miss other potential bugs, so filter out the intentional WARNINGs,
# make sure test doesn't fail because of this warning and fails on other WARNINGs.
filter_xfs_dmesg()
{
local warn="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*"
sed -e "s#$warn#Intentional warnings in asswarn#"
}
TESTDIR="${SCRATCH_MNT}/scratchdir"
TESTFILE="${TESTDIR}/testfile"
@@ -107,8 +99,10 @@ _scratch_mount 2>/dev/null && _fail "mount should not succeed"
echo "+ repair fs"
_repair_scratch_fs >> $seqres.full 2>&1
# mount may trigger related WARNINGs, so filter them.
_check_dmesg filter_xfs_dmesg
# We may trigger assert related WARNINGs if we corrupt log on a
# CONFIG_XFS_WARN or CONFIG_XFS_DEBUG (CONFIG_XFS_ASSERT_FATAL is
# disabled) build, so filter them.
_check_dmesg _filter_assert_dmesg
echo "+ mount image (2)"
_scratch_mount
+2 -3
View File
@@ -52,9 +52,8 @@ rm -f $seqres.full
_supported_fs generic
_supported_os Linux
_require_scratch_nocheck
# we corrupt XFS on purpose, and debug built XFS would crash due to assert
# failure, so skip if we're testing on a debug built XFS
_require_no_xfs_debug
# We corrupt XFS on purpose, and check if assert failures would crash system.
_require_no_xfs_bug_on_assert
_disable_dmesg_check
# Make sure we disable finobt if the filesystem supports it, otherwise, just