mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
check: prepare test report generator infrastructure
Save testcase data which later may be used by report generators - Save failure reason to $err_msg variable - Save number of notrun tests to $n_notrun counter, similar to $n_try,$n_bad Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
be5b594a4c
commit
e11c519918
@@ -28,6 +28,7 @@ try=""
|
|||||||
n_bad=0
|
n_bad=0
|
||||||
sum_bad=0
|
sum_bad=0
|
||||||
bad=""
|
bad=""
|
||||||
|
n_notrun=0
|
||||||
notrun=""
|
notrun=""
|
||||||
interrupt=true
|
interrupt=true
|
||||||
diff="diff -u"
|
diff="diff -u"
|
||||||
@@ -37,6 +38,7 @@ randomize=false
|
|||||||
export here=`pwd`
|
export here=`pwd`
|
||||||
xfile=""
|
xfile=""
|
||||||
brief_test_summary=false
|
brief_test_summary=false
|
||||||
|
err_msg=""
|
||||||
|
|
||||||
DUMP_OUTPUT=false
|
DUMP_OUTPUT=false
|
||||||
|
|
||||||
@@ -368,6 +370,7 @@ _wipe_counters()
|
|||||||
{
|
{
|
||||||
n_try="0"
|
n_try="0"
|
||||||
n_bad="0"
|
n_bad="0"
|
||||||
|
n_notrun="0"
|
||||||
unset try notrun bad
|
unset try notrun bad
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,6 +599,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
|
|||||||
for seq in $list
|
for seq in $list
|
||||||
do
|
do
|
||||||
err=false
|
err=false
|
||||||
|
err_msg=""
|
||||||
if [ ! -f $seq ]; then
|
if [ ! -f $seq ]; then
|
||||||
# Try to get full name in case the user supplied only seq id
|
# Try to get full name in case the user supplied only seq id
|
||||||
# and the test has a name. A bit of hassle to find really
|
# and the test has a name. A bit of hassle to find really
|
||||||
@@ -629,14 +633,17 @@ for section in $HOST_OPTIONS_SECTIONS; do
|
|||||||
|
|
||||||
echo -n "$seqnum"
|
echo -n "$seqnum"
|
||||||
|
|
||||||
if $showme; then
|
if $showme; then
|
||||||
echo
|
echo
|
||||||
continue
|
start=0
|
||||||
fi
|
stop=0
|
||||||
|
n_notrun=`expr $n_notrun + 1`
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f $seq ]; then
|
if [ ! -f $seq ]; then
|
||||||
echo " - no such test?"
|
echo " - no such test?"
|
||||||
else
|
else
|
||||||
# really going to try and run this one
|
# really going to try and run this one
|
||||||
#
|
#
|
||||||
rm -f $seqres.out.bad
|
rm -f $seqres.out.bad
|
||||||
@@ -684,7 +691,8 @@ for section in $HOST_OPTIONS_SECTIONS; do
|
|||||||
|
|
||||||
if [ -f core ]
|
if [ -f core ]
|
||||||
then
|
then
|
||||||
echo -n " [dumped core]"
|
err_msg="[dumped core]"
|
||||||
|
echo -n " $err_msg"
|
||||||
mv core $RESULT_BASE/$seqnum.core
|
mv core $RESULT_BASE/$seqnum.core
|
||||||
err=true
|
err=true
|
||||||
fi
|
fi
|
||||||
@@ -695,15 +703,17 @@ for section in $HOST_OPTIONS_SECTIONS; do
|
|||||||
$timestamp && echo " [not run]" && echo -n " $seqnum -- "
|
$timestamp && echo " [not run]" && echo -n " $seqnum -- "
|
||||||
cat $seqres.notrun
|
cat $seqres.notrun
|
||||||
notrun="$notrun $seqnum"
|
notrun="$notrun $seqnum"
|
||||||
|
n_notrun=`expr $n_notrun + 1`
|
||||||
else
|
else
|
||||||
if [ $sts -ne 0 ]
|
if [ $sts -ne 0 ]
|
||||||
then
|
then
|
||||||
echo -n " [failed, exit status $sts]"
|
err_msg="[failed, exit status $sts]"
|
||||||
|
echo -n " $err_msg"
|
||||||
err=true
|
err=true
|
||||||
fi
|
fi
|
||||||
if [ ! -f $seq.out ]
|
if [ ! -f $seq.out ]
|
||||||
then
|
then
|
||||||
echo " - no qualified output"
|
_dump_err "no qualified output"
|
||||||
err=true
|
err=true
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -733,6 +743,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
|
|||||||
" to see the entire diff)"
|
" to see the entire diff)"
|
||||||
fi; } | \
|
fi; } | \
|
||||||
sed -e 's/^\(.\)/ \1/'
|
sed -e 's/^\(.\)/ \1/'
|
||||||
|
err_msg="output mismatch (see $diff $seq.out $seqres.out.bad)"
|
||||||
err=true
|
err=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
+2
-6
@@ -105,9 +105,7 @@ _check_btrfs_filesystem()
|
|||||||
if [ -f ${RESULT_DIR}/require_scratch.require_qgroup_report ]; then
|
if [ -f ${RESULT_DIR}/require_scratch.require_qgroup_report ]; then
|
||||||
$BTRFS_UTIL_PROG check $device --qgroup-report > $tmp.qgroup_report 2>&1
|
$BTRFS_UTIL_PROG check $device --qgroup-report > $tmp.qgroup_report 2>&1
|
||||||
if grep -qE "Counts for qgroup.*are different" $tmp.qgroup_report ; then
|
if grep -qE "Counts for qgroup.*are different" $tmp.qgroup_report ; then
|
||||||
echo "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers (see $seqres.full)"
|
_log_err "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers"
|
||||||
echo "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers" \
|
|
||||||
>> $seqres.full
|
|
||||||
echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
|
echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
|
||||||
cat $tmp.qgroup_report >>$seqres.full
|
cat $tmp.qgroup_report >>$seqres.full
|
||||||
echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
|
echo "*** qgroup_report.$FSTYP output ***" >>$seqres.full
|
||||||
@@ -117,9 +115,7 @@ _check_btrfs_filesystem()
|
|||||||
|
|
||||||
$BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
|
$BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "_check_btrfs_filesystem: filesystem on $device is inconsistent (see $seqres.full)"
|
_log_err "_check_btrfs_filesystem: filesystem on $device is inconsistent"
|
||||||
|
|
||||||
echo "_check_btrfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full
|
|
||||||
echo "*** fsck.$FSTYP output ***" >>$seqres.full
|
echo "*** fsck.$FSTYP output ***" >>$seqres.full
|
||||||
cat $tmp.fsck >>$seqres.full
|
cat $tmp.fsck >>$seqres.full
|
||||||
echo "*** end fsck.$FSTYP output" >>$seqres.full
|
echo "*** end fsck.$FSTYP output" >>$seqres.full
|
||||||
|
|||||||
@@ -115,6 +115,25 @@ then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_dump_err()
|
||||||
|
{
|
||||||
|
err_msg="$*"
|
||||||
|
echo "$err_msg"
|
||||||
|
}
|
||||||
|
|
||||||
|
_dump_err2()
|
||||||
|
{
|
||||||
|
err_msg="$*"
|
||||||
|
>2& echo "$err_msg"
|
||||||
|
}
|
||||||
|
|
||||||
|
_log_err()
|
||||||
|
{
|
||||||
|
err_msg="$*"
|
||||||
|
echo "$err_msg" | tee -a $seqres.full
|
||||||
|
echo "(see $seqres.full for details)"
|
||||||
|
}
|
||||||
|
|
||||||
# make sure we have a standard umask
|
# make sure we have a standard umask
|
||||||
umask 022
|
umask 022
|
||||||
|
|
||||||
@@ -1121,7 +1140,9 @@ _repair_scratch_fs()
|
|||||||
_scratch_xfs_repair "$@" 2>&1
|
_scratch_xfs_repair "$@" 2>&1
|
||||||
res=$?
|
res=$?
|
||||||
fi
|
fi
|
||||||
test $res -ne 0 && >&2 echo "xfs_repair failed, err=$res"
|
if [ $res -ne 0 ]; then
|
||||||
|
_dump_err2 "xfs_repair failed, err=$res"
|
||||||
|
fi
|
||||||
return $res
|
return $res
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -1133,7 +1154,7 @@ _repair_scratch_fs()
|
|||||||
res=0
|
res=0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
>&2 echo "fsck.$FSTYP failed, err=$res"
|
_dump_err2 "fsck.$FSTYP failed, err=$res"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
return $res
|
return $res
|
||||||
@@ -2276,7 +2297,7 @@ _mount_or_remount_rw()
|
|||||||
_overlay_mount $device $mountpoint
|
_overlay_mount $device $mountpoint
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "!!! failed to remount $device on $mountpoint"
|
_dump_err "!!! failed to remount $device on $mountpoint"
|
||||||
return 0 # ok=0
|
return 0 # ok=0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@@ -2310,9 +2331,7 @@ _check_generic_filesystem()
|
|||||||
fsck -t $FSTYP $FSCK_OPTIONS $device >$tmp.fsck 2>&1
|
fsck -t $FSTYP $FSCK_OPTIONS $device >$tmp.fsck 2>&1
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "_check_generic_filesystem: filesystem on $device is inconsistent (see $seqres.full)"
|
_log_err "_check_generic_filesystem: filesystem on $device is inconsistent"
|
||||||
|
|
||||||
echo "_check_generic filesystem: filesystem on $device is inconsistent" >>$seqres.full
|
|
||||||
echo "*** fsck.$FSTYP output ***" >>$seqres.full
|
echo "*** fsck.$FSTYP output ***" >>$seqres.full
|
||||||
cat $tmp.fsck >>$seqres.full
|
cat $tmp.fsck >>$seqres.full
|
||||||
echo "*** end fsck.$FSTYP output" >>$seqres.full
|
echo "*** end fsck.$FSTYP output" >>$seqres.full
|
||||||
@@ -3191,7 +3210,7 @@ _check_dmesg()
|
|||||||
-e "general protection fault:" \
|
-e "general protection fault:" \
|
||||||
$seqres.dmesg
|
$seqres.dmesg
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
|
_dump_err "_check_dmesg: something found in dmesg (see $seqres.dmesg)"
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
rm -f $seqres.dmesg
|
rm -f $seqres.dmesg
|
||||||
|
|||||||
+6
-16
@@ -333,7 +333,7 @@ _check_xfs_filesystem()
|
|||||||
if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then
|
if [ -n "$TEST_XFS_SCRUB" ] && [ -x "$XFS_SCRUB_PROG" ]; then
|
||||||
"$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full
|
"$XFS_SCRUB_PROG" $scrubflag -vd $device >>$seqres.full
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "filesystem on $device failed scrub (see $seqres.full)"
|
_log_err "filesystem on $device failed scrub"
|
||||||
ok=0
|
ok=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -344,9 +344,7 @@ _check_xfs_filesystem()
|
|||||||
$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
|
$XFS_LOGPRINT_PROG -t $extra_log_options $device 2>&1 \
|
||||||
| tee $tmp.logprint | grep -q "<CLEAN>"
|
| tee $tmp.logprint | grep -q "<CLEAN>"
|
||||||
if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]; then
|
if [ $? -ne 0 -a "$HOSTOS" = "Linux" ]; then
|
||||||
echo "_check_xfs_filesystem: filesystem on $device has dirty log (see $seqres.full)"
|
_log_err "_check_xfs_filesystem: filesystem on $device has dirty log"
|
||||||
|
|
||||||
echo "_check_xfs_filesystem: filesystem on $device has dirty log" >>$seqres.full
|
|
||||||
echo "*** xfs_logprint -t output ***" >>$seqres.full
|
echo "*** xfs_logprint -t output ***" >>$seqres.full
|
||||||
cat $tmp.logprint >>$seqres.full
|
cat $tmp.logprint >>$seqres.full
|
||||||
echo "*** end xfs_logprint output" >>$seqres.full
|
echo "*** end xfs_logprint output" >>$seqres.full
|
||||||
@@ -362,9 +360,7 @@ _check_xfs_filesystem()
|
|||||||
_fix_malloc >$tmp.fs_check
|
_fix_malloc >$tmp.fs_check
|
||||||
fi
|
fi
|
||||||
if [ -s $tmp.fs_check ]; then
|
if [ -s $tmp.fs_check ]; then
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (c) (see $seqres.full)"
|
_log_err "_check_xfs_filesystem: filesystem on $device is inconsistent (c)"
|
||||||
|
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full
|
|
||||||
echo "*** xfs_check output ***" >>$seqres.full
|
echo "*** xfs_check output ***" >>$seqres.full
|
||||||
cat $tmp.fs_check >>$seqres.full
|
cat $tmp.fs_check >>$seqres.full
|
||||||
echo "*** end xfs_check output" >>$seqres.full
|
echo "*** end xfs_check output" >>$seqres.full
|
||||||
@@ -374,9 +370,7 @@ _check_xfs_filesystem()
|
|||||||
|
|
||||||
$XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
$XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (r) (see $seqres.full)"
|
_log_err "_check_xfs_filesystem: filesystem on $device is inconsistent (r)"
|
||||||
|
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full
|
|
||||||
echo "*** xfs_repair -n output ***" >>$seqres.full
|
echo "*** xfs_repair -n output ***" >>$seqres.full
|
||||||
cat $tmp.repair | _fix_malloc >>$seqres.full
|
cat $tmp.repair | _fix_malloc >>$seqres.full
|
||||||
echo "*** end xfs_repair output" >>$seqres.full
|
echo "*** end xfs_repair output" >>$seqres.full
|
||||||
@@ -389,9 +383,7 @@ _check_xfs_filesystem()
|
|||||||
if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then
|
if [ -n "$TEST_XFS_REPAIR_REBUILD" ]; then
|
||||||
$XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
$XFS_REPAIR_PROG $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild) (see $seqres.full)"
|
_log_err "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild)"
|
||||||
|
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild)" >>$seqres.full
|
|
||||||
echo "*** xfs_repair output ***" >>$seqres.full
|
echo "*** xfs_repair output ***" >>$seqres.full
|
||||||
cat $tmp.repair | _fix_malloc >>$seqres.full
|
cat $tmp.repair | _fix_malloc >>$seqres.full
|
||||||
echo "*** end xfs_repair output" >>$seqres.full
|
echo "*** end xfs_repair output" >>$seqres.full
|
||||||
@@ -402,9 +394,7 @@ _check_xfs_filesystem()
|
|||||||
|
|
||||||
$XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
$XFS_REPAIR_PROG -n $extra_options $extra_log_options $extra_rt_options $device >$tmp.repair 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify) (see $seqres.full)"
|
_log_err "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify)"
|
||||||
|
|
||||||
echo "_check_xfs_filesystem: filesystem on $device is inconsistent (rebuild-reverify)" >>$seqres.full
|
|
||||||
echo "*** xfs_repair -n output ***" >>$seqres.full
|
echo "*** xfs_repair -n output ***" >>$seqres.full
|
||||||
cat $tmp.repair | _fix_malloc >>$seqres.full
|
cat $tmp.repair | _fix_malloc >>$seqres.full
|
||||||
echo "*** end xfs_repair output" >>$seqres.full
|
echo "*** end xfs_repair output" >>$seqres.full
|
||||||
|
|||||||
Reference in New Issue
Block a user