From: David Disseldorp <ddiss@suse.de>
To: fstests@vger.kernel.org
Cc: David Disseldorp <ddiss@suse.de>
Subject: [PATCH 6/6] check: remove err and first_test variables
Date: Mon, 20 Jun 2022 21:29:34 +0200 [thread overview]
Message-ID: <20220620192934.21694-7-ddiss@suse.de> (raw)
In-Reply-To: <20220620192934.21694-1-ddiss@suse.de>
tc_status can be used for both of these.
Signed-off-by: David Disseldorp <ddiss@suse.de>
---
check | 41 ++++++++++++++++-------------------------
1 file changed, 16 insertions(+), 25 deletions(-)
diff --git a/check b/check
index 8423d7a1..2ea2920f 100755
--- a/check
+++ b/check
@@ -725,23 +725,17 @@ function run_section()
seqres="$check"
_check_test_fs
- err=false
- first_test=true
+ local tc_status="init"
prev_seq=""
for seq in $list ; do
# Run report for previous test!
- if $err ; then
+ if [ "$tc_status" == "fail" ]; then
bad+=("$seqnum")
- tc_status="fail"
fi
- if $do_report && ! $first_test ; then
- if [ $tc_status != "expunge" ] ; then
- _make_testcase_report "$prev_seq" "$tc_status"
- fi
+ if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then
+ _make_testcase_report "$prev_seq" "$tc_status"
fi
- first_test=false
- err=false
prev_seq="$seq"
if [ ! -f $seq ]; then
# Try to get full name in case the user supplied only
@@ -845,7 +839,7 @@ function run_section()
if [ -f core ]; then
_dump_err_cont "[dumped core]"
mv core $RESULT_BASE/$seqnum.core
- err=true
+ tc_status="fail"
fi
if [ -f $seqres.notrun ]; then
@@ -870,15 +864,15 @@ function run_section()
_scratch_unmount 2> /dev/null
rm -f ${RESULT_DIR}/require_test*
rm -f ${RESULT_DIR}/require_scratch*
- err=true
+ tc_status="fail"
else
# The test apparently passed, so check for corruption
# and log messages that shouldn't be there. Run the
# checking tools from a subshell with adjusted OOM
# score so that the OOM killer will target them instead
# of the check script itself.
- (_adjust_oom_score 250; _check_filesystems) || err=true
- _check_dmesg || err=true
+ (_adjust_oom_score 250; _check_filesystems) || tc_status="fail"
+ _check_dmesg || tc_status="fail"
fi
# Reload the module after each test to check for leaks or
@@ -892,7 +886,7 @@ function run_section()
# Scan for memory leaks after every test so that associating
# a leak to a particular test will be as accurate as possible.
- _check_kmemleak || err=true
+ _check_kmemleak || tc_status="fail"
# test ends after all checks are done.
$timestamp && _timestamp
@@ -900,7 +894,7 @@ function run_section()
if [ ! -f $seq.out ]; then
_dump_err "no qualified output"
- err=true
+ tc_status="fail"
continue;
fi
@@ -909,7 +903,7 @@ function run_section()
# version.
sed -i "s/\`/\'/g" $tmp.out
if diff $seq.out $tmp.out >/dev/null 2>&1 ; then
- if ! $err ; then
+ if [ "$tc_status" != "fail" ]; then
echo "$seqnum `expr $stop - $start`" >>$tmp.time
echo -n " `expr $stop - $start`s"
fi
@@ -926,10 +920,10 @@ function run_section()
echo "(Run '$diff $here/$seq.out $seqres.out.bad'" \
" to see the entire diff)"
fi; } | sed -e 's/^\(.\)/ \1/'
- err=true
+ tc_status="fail"
fi
if [ -f $seqres.hints ]; then
- if $err; then
+ if [ "$tc_status" == "fail" ]; then
echo
cat $seqres.hints
else
@@ -939,14 +933,11 @@ function run_section()
done
# make sure we record the status of the last test we ran.
- if $err ; then
+ if [ "$tc_status" == "fail" ]; then
bad+=("$seqnum")
- tc_status="fail"
fi
- if $do_report && ! $first_test ; then
- if [ $tc_status != "expunge" ] ; then
- _make_testcase_report "$prev_seq" "$tc_status"
- fi
+ if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then
+ _make_testcase_report "$prev_seq" "$tc_status"
fi
sect_stop=`_wallclock`
--
2.35.3
next prev parent reply other threads:[~2022-06-20 19:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 19:29 [PATCH 0/6] check: minor cleanups and xunit report fix David Disseldorp
2022-06-20 19:29 ` [PATCH 1/6] check: avoid FSTYP=<fstyp parameter> repetition David Disseldorp
2022-06-22 4:27 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 2/6] check: simplify check.time parsing David Disseldorp
2022-06-22 4:31 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 3/6] report: drop unused _xunit_make_section_report parameter David Disseldorp
2022-06-22 4:37 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 4/6] report: fix xunit tests count David Disseldorp
2022-06-22 5:03 ` Zorro Lang
2022-06-20 19:29 ` [PATCH 5/6] check: use arrays instead of separate n_ counters David Disseldorp
2022-06-22 5:11 ` Zorro Lang
2022-06-20 19:29 ` David Disseldorp [this message]
2022-06-22 5:15 ` [PATCH 6/6] check: remove err and first_test variables Zorro Lang
2022-06-22 5:21 ` [PATCH 0/6] check: minor cleanups and xunit report fix Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220620192934.21694-7-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.