Skip to content

Commit 3aee453

Browse files
paulmckrcuNeeraj Upadhyay (AMD)
authored andcommitted
torture: Make torture.sh tolerate runs having bad kvm.sh arguments
Currently, torture.sh assumes excessive levels of reviewer competence and thus fails to gracefully handle cases where it is tricked into giving kvm.sh invalid arguments. This commit therefore upgrades error handling to more gracefully handle this situation. Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent d573000 commit 3aee453

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

tools/testing/selftests/rcutorture/bin/torture.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,19 @@ function torture_set {
378378
then
379379
curflavor=$flavor
380380
torture_one "$@"
381-
mv $T/last-resdir $T/last-resdir-nodebug || :
381+
if test -e $T/last-resdir
382+
then
383+
mv $T/last-resdir $T/last-resdir-nodebug || :
384+
fi
382385
fi
383386
if test "$do_kasan" = "yes"
384387
then
385388
curflavor=${flavor}-kasan
386389
torture_one "$@" --kasan
387-
mv $T/last-resdir $T/last-resdir-kasan || :
390+
if test -e $T/last-resdir
391+
then
392+
mv $T/last-resdir $T/last-resdir-kasan || :
393+
fi
388394
fi
389395
if test "$do_kcsan" = "yes"
390396
then
@@ -400,7 +406,10 @@ function torture_set {
400406
chk_rdr_state="CONFIG_RCU_TORTURE_TEST_CHK_RDR_STATE=y"
401407
fi
402408
torture_one "$@" --kconfig "CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y ${kcsan_expert} ${chk_rdr_state}" $kcsan_kmake_tag $cur_kcsan_kmake_args --kcsan
403-
mv $T/last-resdir $T/last-resdir-kcsan || :
409+
if test -e $T/last-resdir
410+
then
411+
mv $T/last-resdir $T/last-resdir-kcsan || :
412+
fi
404413
fi
405414
}
406415

@@ -704,7 +713,14 @@ nfailures=0
704713
echo FAILURES: | tee -a $T/log
705714
if test -s "$T/failures"
706715
then
707-
awk < "$T/failures" -v sq="'" '{ print "echo " sq $0 sq; print "sed -e " sq "1,/^ --- .* Test summary:$/d" sq " " $2 "/log | grep Summary: | sed -e " sq "s/^[^S]*/ /" sq; }' | sh | tee -a $T/log | tee "$T/failuresum"
716+
awk < "$T/failures" -v sq="'" '
717+
{
718+
print "echo " sq $0 sq;
719+
if ($2 != "")
720+
print "sed -e " sq "1,/^ --- .* Test summary:$/d" sq " " $2 "/log | grep Summary: | sed -e " sq "s/^[^S]*/ /" sq;
721+
else
722+
print "echo " sq " " sq "Run failed to produce results directory.";
723+
}' | sh | tee -a $T/log | tee "$T/failuresum"
708724
nfailures="`wc -l "$T/failures" | awk '{ print $1 }'`"
709725
grep "^ Summary: " "$T/failuresum" |
710726
grep -v '^ Summary: Bugs: [0-9]* (all bugs kcsan)$' > "$T/nonkcsan"
@@ -714,13 +730,13 @@ then
714730
fi
715731
ret=2
716732
fi
717-
if test "$do_kcsan" = "yes"
733+
if test "$do_kcsan" = "yes" && test -e tools/testing/selftests/rcutorture/res/$ds
718734
then
719735
TORTURE_KCONFIG_KCSAN_ARG=1 tools/testing/selftests/rcutorture/bin/kcsan-collapse.sh tools/testing/selftests/rcutorture/res/$ds > tools/testing/selftests/rcutorture/res/$ds/kcsan.sum
720736
fi
721737
echo Started at $startdate, ended at `date`, duration `get_starttime_duration $starttime`. | tee -a $T/log
722738
echo Summary: Successes: $nsuccesses Failures: $nfailures. | tee -a $T/log
723-
tdir="`cat $T/successes $T/failures | head -1 | awk '{ print $NF }' | sed -e 's,/[^/]\+/*$,,'`"
739+
tdir="`cat $T/successes $T/failures | awk 'NF > 1 { print $NF }' | head -1 | sed -e 's,/[^/]\+/*$,,'`"
724740
if test -n "$tdir"
725741
then
726742
find "$tdir" -name 'ConfigFragment.diags' -print > $T/configerrors

0 commit comments

Comments
 (0)