2 # SPDX-License-Identifier: GPL-2.0+
4 # Given the results directories for previous KVM-based torture runs,
5 # check the build and console output for errors. Given a directory
6 # containing results directories, this recursively checks them all.
8 # Usage: kvm-recheck.sh resdir ...
10 # Returns status reflecting the success or not of the last run specified.
12 # Copyright (C) IBM Corporation, 2011
14 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
16 T=/tmp/kvm-recheck.sh.$$
19 PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
24 dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u`
27 if test -n "$firsttime"
30 resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'`
33 TORTURE_SUITE="`cat $i/../torture_suite`"
34 configfile=`echo $i | sed -e 's,^.*/,,'`
35 rm -f $i/console.log.*.diags
36 case "${TORTURE_SUITE}" in
40 kvm-recheck-${TORTURE_SUITE}.sh $i
42 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137
44 echo QEMU error, output:
46 elif test -f "$i/console.log"
48 if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137
52 configcheck.sh $i/.config $i/ConfigFragment > $T 2>&1
54 if test -r $i/Make.oldconfig.err
56 cat $i/Make.oldconfig.err
58 parse-build.sh $i/Make.out $configfile
59 parse-console.sh $i/console.log $configfile
60 if test -r $i/Warnings
65 if test -f "$i/buildonly"
67 echo Build-only run, no boot/test
68 configcheck.sh $i/.config $i/ConfigFragment
69 parse-build.sh $i/Make.out $configfile
70 elif test -f "$i/qemu-cmd"
75 print_bug Build failed
80 if test -f "$rd/kcsan.sum"
85 elif grep -q CONFIG_KCSAN=y $T
87 echo "Compiler or architecture does not support KCSAN!"
88 echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'?
89 elif test -s "$rd/kcsan.sum"
91 echo KCSAN summary in $rd/kcsan.sum
93 echo Clean KCSAN run in $rd
97 EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1
98 builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`"
99 if test "$builderrors" -gt 0
101 echo $builderrors runs with build errors.
104 runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`"
105 if test "$runerrors" -gt 0
107 echo $runerrors runs with runtime errors.