-e "s#$warn9#Intentional warnings in dio_complete#"
}
+# We generate assert related WARNINGs on purpose and make sure test doesn't fail
+# because of these warnings. This is a helper for _check_dmesg() to filter out
+# them.
+_filter_assert_dmesg()
+{
+ local warn1="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*"
+ local warn2="WARNING:.*fs/xfs/xfs_message\.c:.*assfail.*"
+ sed -e "s#$warn1#Intentional warnings in asswarn#" \
+ -e "s#$warn2#Intentional warnings in assfail#"
+}
+
# make sure this script returns success
/bin/true
fi
}
+# Require that assertions will not crash the system.
+#
+# Assertions would always crash the system if XFS assert fatal was enabled
+# (CONFIG_XFS_ASSERT_FATAL=y). If a test is designed to trigger an assertion,
+# skip the test on a CONFIG_XFS_ASSERT_FATAL built XFS by default. Note:
+# CONFIG_XFS_ASSERT_FATAL can be disabled by setting bug_on_assert to zero if
+# we want test to run.
+_require_no_xfs_bug_on_assert()
+{
+ if [ -f /sys/fs/xfs/debug/bug_on_assert ]; then
+ grep -q "1" /sys/fs/xfs/debug/bug_on_assert && \
+ _notrun "test requires XFS bug_on_assert to be off, turn it off to run the test"
+ else
+ # Note: Prior to the creation of CONFIG_XFS_ASSERT_FATAL (and
+ # the sysfs knob bug_on_assert), assertions would always crash
+ # the system if XFS debug was enabled (CONFIG_XFS_DEBUG=y). If
+ # a test is designed to trigger an assertion and the test
+ # designer does not want to hang fstests, skip the test.
+ _require_no_xfs_debug
+ fi
+}
+
# Get a metadata field
# The first arg is the field name
# The rest of the arguments are xfs_db commands to find the metadata.
_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
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"
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
_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