torture: Make kvm-recheck.sh report .config errors
authorPaul E. McKenney <paulmck@kernel.org>
Tue, 13 Jun 2023 18:27:04 +0000 (11:27 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 14 Jul 2023 22:10:57 +0000 (15:10 -0700)
Currently, kvm-recheck.sh will print out any .config errors with messages
of the form:

:CONFIG_TASKS_TRACE_RCU=y: improperly set

However, if these are the only errors, the resulting exit code will
declare the run successful.  This commit therefore causes kvm-recheck.sh
to record .config errors in the results directory in a file named
ConfigFragment.diags and also returns a non-zero error code in that case.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh

index 1df7e695edf75035f61eb572553c0938478d9b5e..97bdacc3fc55fcc0e4f9cd0dd076ec097b27faea 100755 (executable)
@@ -16,6 +16,8 @@
 T=/tmp/kvm-recheck.sh.$$
 trap 'rm -f $T' 0 2
 
+configerrors=0
+
 PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
 . functions.sh
 for rd in "$@"
@@ -32,7 +34,7 @@ do
                fi
                TORTURE_SUITE="`cat $i/../torture_suite`" ; export TORTURE_SUITE
                configfile=`echo $i | sed -e 's,^.*/,,'`
-               rm -f $i/console.log.*.diags
+               rm -f $i/console.log.*.diags $i/ConfigFragment.diags
                case "${TORTURE_SUITE}" in
                X*)
                        ;;
@@ -49,8 +51,14 @@ do
                        then
                                echo QEMU killed
                        fi
-                       configcheck.sh $i/.config $i/ConfigFragment > $T 2>&1
-                       cat $T
+                       configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1
+                       if test -s $i/ConfigFragment.diags
+                       then
+                               cat $i/ConfigFragment.diags
+                               configerrors=$((configerrors+1))
+                       else
+                               rm $i/ConfigFragment.diags
+                       fi
                        if test -r $i/Make.oldconfig.err
                        then
                                cat $i/Make.oldconfig.err
@@ -65,7 +73,14 @@ do
                        if test -f "$i/buildonly"
                        then
                                echo Build-only run, no boot/test
-                               configcheck.sh $i/.config $i/ConfigFragment
+                               configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1
+                               if test -s $i/ConfigFragment.diags
+                               then
+                                       cat $i/ConfigFragment.diags
+                                       configerrors=$((configerrors+1))
+                               else
+                                       rm $i/ConfigFragment.diags
+                               fi
                                parse-build.sh $i/Make.out $configfile
                        elif test -f "$i/qemu-cmd"
                        then
@@ -79,10 +94,10 @@ do
        done
        if test -f "$rd/kcsan.sum"
        then
-               if ! test -f $T
+               if ! test -f $i/ConfigFragment.diags
                then
                        :
-               elif grep -q CONFIG_KCSAN=y $T
+               elif grep -q CONFIG_KCSAN=y $i/ConfigFragment.diags
                then
                        echo "Compiler or architecture does not support KCSAN!"
                        echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'?
@@ -94,17 +109,23 @@ do
                fi
        fi
 done
+
+if test "$configerrors" -gt 0
+then
+       echo $configerrors runs with .config errors.
+       ret=1
+fi
 EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1
 builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`"
 if test "$builderrors" -gt 0
 then
        echo $builderrors runs with build errors.
-       ret=1
+       ret=2
 fi
 runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`"
 if test "$runerrors" -gt 0
 then
        echo $runerrors runs with runtime errors.
-       ret=2
+       ret=3
 fi
 exit $ret