From: David Disseldorp <ddiss@suse.de>
To: fstests@vger.kernel.org, tytso@mit.edu
Cc: djwong@kernel.org, zlang@redhat.com, David Disseldorp <ddiss@suse.de>
Subject: [PATCH v4 4/5] check: append bad / notrun arrays in helper function
Date: Fri, 8 Jul 2022 10:51:41 +0200 [thread overview]
Message-ID: <20220708085142.20991-5-ddiss@suse.de> (raw)
In-Reply-To: <20220708085142.20991-1-ddiss@suse.de>
Currently the @try, @bad and @notrun arrays are appended with seqnum at
different points in the main run_section() loop:
- @try: shortly prior to test script execution
- @notrun: on list (check -n), or after .notrun flagged test completion
- @bad: at the start of subsequent test loop and loop exit
For future loop-test-following-failure functionality it makes sense to
combine some of these steps. This change moves both @notrun and @bad
appends into a helper function which is called at the end of each loop
iteration.
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
check | 68 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 29 deletions(-)
diff --git a/check b/check
index 08857f7e..6dbdb2a8 100755
--- a/check
+++ b/check
@@ -553,6 +553,32 @@ _expunge_test()
return 0
}
+# Retain in @bad / @notrun the result of the just-run @test_seq. @try array
+# entries are added prior to execution.
+_stash_test_status() {
+ local test_seq="$1"
+ local test_status="$2"
+
+ if $do_report && [[ $test_status != "expunge" ]]; then
+ _make_testcase_report "$section" "$test_seq" \
+ "$test_status" "$((stop - start))"
+ fi
+
+ case "$test_status" in
+ fail)
+ bad+=("$test_seq")
+ ;;
+ list|notrun)
+ notrun+=("$test_seq")
+ ;;
+ pass|expunge)
+ ;;
+ *)
+ echo "Unexpected test $test_seq status: $test_status"
+ ;;
+ esac
+}
+
# Can we run systemd scopes?
HAVE_SYSTEMD_SCOPES=
systemctl reset-failed "fstests-check" &>/dev/null
@@ -732,19 +758,8 @@ function run_section()
seqres="$check"
_check_test_fs
- local tc_status="init"
- prev_seq=""
+ local tc_status
for seq in $list ; do
- # Run report for previous test!
- if [ "$tc_status" == "fail" ]; then
- bad+=("$seqnum")
- fi
- if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then
- _make_testcase_report "$section" "$seqnum" \
- "$tc_status" "$((stop - start))"
- fi
-
- prev_seq="$seq"
if [ ! -f $seq ]; then
# Try to get full name in case the user supplied only
# seq id and the test has a name. A bit of hassle to
@@ -784,20 +799,21 @@ function run_section()
if $showme; then
_expunge_test $seqnum
if [ $? -eq 1 ]; then
- tc_status="expunge"
- continue
+ tc_status="expunge"
+ else
+ echo
+ start=0
+ stop=0
+ tc_status="list"
fi
- echo
- start=0
- stop=0
- tc_status="list"
- notrun+=("$seqnum")
+ _stash_test_status "$seqnum" "$tc_status"
continue
fi
tc_status="pass"
if [ ! -f $seq ]; then
echo " - no such test?"
+ _stash_test_status "$seqnum" "$tc_status"
continue
fi
@@ -808,6 +824,7 @@ function run_section()
_expunge_test $seqnum
if [ $? -eq 1 ]; then
tc_status="expunge"
+ _stash_test_status "$seqnum" "$tc_status"
continue
fi
@@ -857,8 +874,8 @@ function run_section()
$timestamp && echo " [not run]" && \
echo -n " $seqnum -- "
cat $seqres.notrun
- notrun+=("$seqnum")
tc_status="notrun"
+ _stash_test_status "$seqnum" "$tc_status"
# Unmount the scratch fs so that we can wipe the scratch
# dev state prior to the next test run.
@@ -903,6 +920,7 @@ function run_section()
if [ ! -f $seq.out ]; then
_dump_err "no qualified output"
tc_status="fail"
+ _stash_test_status "$seqnum" "$tc_status"
continue;
fi
@@ -938,17 +956,9 @@ function run_section()
rm -f $seqres.hints
fi
fi
+ _stash_test_status "$seqnum" "$tc_status"
done
- # make sure we record the status of the last test we ran.
- if [ "$tc_status" == "fail" ]; then
- bad+=("$seqnum")
- fi
- if $do_report && [[ ! $tc_status =~ ^(init|expunge)$ ]]; then
- _make_testcase_report "$section" "$seqnum" "$tc_status" \
- "$((stop - start))"
- fi
-
sect_stop=`_wallclock`
interrupt=false
_wrapup
--
2.35.3
next prev parent reply other threads:[~2022-07-08 8:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 8:51 [PATCH v4 0/5] check: add option to rerun failed tests David Disseldorp
2022-07-08 8:51 ` [PATCH v4 1/5] report: use array for REPORT_ENV_LIST David Disseldorp
2022-07-08 8:51 ` [PATCH v4 2/5] report: pass through most details as function parameters David Disseldorp
2022-07-08 8:51 ` [PATCH v4 3/5] check: make a few variables local David Disseldorp
2022-07-08 8:51 ` David Disseldorp [this message]
2022-07-08 8:51 ` [PATCH v4 5/5] check: add -L <n> parameter to rerun failed tests David Disseldorp
2022-07-08 15:21 ` Darrick J. Wong
2022-07-08 16:36 ` [PATCH v4 0/5] check: add option " 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=20220708085142.20991-5-ddiss@suse.de \
--to=ddiss@suse.de \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=zlang@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox