common: move _check_dmesg to common/rc

Move _check_dmesg to common/rc so that tests could call it directly.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Eryu Guan
2015-08-04 14:10:48 +10:00
committed by Dave Chinner
parent 996d96713b
commit 7a2354e967
2 changed files with 30 additions and 29 deletions
+3 -29
View File
@@ -396,32 +396,6 @@ _check_filesystems()
fi
}
_check_dmesg()
{
if [ ! -f ${RESULT_DIR}/check_dmesg ]; then
return
fi
rm -f ${RESULT_DIR}/check_dmesg
# search the dmesg log of last run of $seqnum for possible failures
# use sed \cregexpc address type, since $seqnum contains "/"
dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \
tac >$seqres.dmesg
grep -q -e "kernel BUG at" \
-e "WARNING:" \
-e "BUG:" \
-e "Oops:" \
-e "possible recursive locking detected" \
$seqres.dmesg
if [ $? -eq 0 ]; then
echo "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
err=true
else
rm -f $seqres.dmesg
fi
}
_prepare_test_list
if $OPTIONS_HAVE_SECTIONS; then
@@ -542,7 +516,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
# the filename for the test and the name output are different.
# we don't include the tests/ directory in the name output.
seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
export seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
# Similarly, the result directory needs to replace the tests/
# part of the test location.
@@ -593,7 +567,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
[ ! -x $seq ] && chmod u+x $seq # ensure we can run it
$LOGGER_PROG "run xfstest $seqnum"
if [ -w /dev/kmsg ]; then
date_time=`date +"%F %T"`
export date_time=`date +"%F %T"`
echo "run fstests $seqnum at $date_time" > /dev/kmsg
# _check_dmesg depends on this log in dmesg
touch ${RESULT_DIR}/check_dmesg
@@ -663,7 +637,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
try="$try $seqnum"
n_try=`expr $n_try + 1`
_check_filesystems
_check_dmesg
_check_dmesg || err=true
fi
fi
+27
View File
@@ -2973,6 +2973,33 @@ _get_device_size()
grep `_short_dev $1` /proc/partitions | awk '{print $3}'
}
# check dmesg log for WARNING/Oops/etc.
_check_dmesg()
{
if [ ! -f ${RESULT_DIR}/check_dmesg ]; then
return 0
fi
rm -f ${RESULT_DIR}/check_dmesg
# search the dmesg log of last run of $seqnum for possible failures
# use sed \cregexpc address type, since $seqnum contains "/"
dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \
tac >$seqres.dmesg
grep -q -e "kernel BUG at" \
-e "WARNING:" \
-e "BUG:" \
-e "Oops:" \
-e "possible recursive locking detected" \
$seqres.dmesg
if [ $? -eq 0 ]; then
echo "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
return 1
else
rm -f $seqres.dmesg
return 0
fi
}
# don't check dmesg log after test
_disable_dmesg_check()
{