forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/tools/testing/selftests/rcutorture/bin/kvm-recheck.sh
....@@ -1,4 +1,5 @@
11 #!/bin/bash
2
+# SPDX-License-Identifier: GPL-2.0+
23 #
34 # Given the results directories for previous KVM-based torture runs,
45 # check the build and console output for errors. Given a directory
....@@ -6,23 +7,14 @@
67 #
78 # Usage: kvm-recheck.sh resdir ...
89 #
9
-# This program is free software; you can redistribute it and/or modify
10
-# it under the terms of the GNU General Public License as published by
11
-# the Free Software Foundation; either version 2 of the License, or
12
-# (at your option) any later version.
13
-#
14
-# This program is distributed in the hope that it will be useful,
15
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
-# GNU General Public License for more details.
18
-#
19
-# You should have received a copy of the GNU General Public License
20
-# along with this program; if not, you can access it online at
21
-# http://www.gnu.org/licenses/gpl-2.0.html.
10
+# Returns status reflecting the success or not of the last run specified.
2211 #
2312 # Copyright (C) IBM Corporation, 2011
2413 #
25
-# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
14
+# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
15
+
16
+T=/tmp/kvm-recheck.sh.$$
17
+trap 'rm -f $T' 0 2
2618
2719 PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
2820 . functions.sh
....@@ -39,11 +31,21 @@
3931 head -1 $resdir/log
4032 fi
4133 TORTURE_SUITE="`cat $i/../TORTURE_SUITE`"
34
+ configfile=`echo $i | sed -e 's,^.*/,,'`
4235 rm -f $i/console.log.*.diags
4336 kvm-recheck-${TORTURE_SUITE}.sh $i
44
- if test -f "$i/console.log"
37
+ if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137
4538 then
46
- configcheck.sh $i/.config $i/ConfigFragment
39
+ echo QEMU error, output:
40
+ cat $i/qemu-output
41
+ elif test -f "$i/console.log"
42
+ then
43
+ if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137
44
+ then
45
+ echo QEMU killed
46
+ fi
47
+ configcheck.sh $i/.config $i/ConfigFragment > $T 2>&1
48
+ cat $T
4749 if test -r $i/Make.oldconfig.err
4850 then
4951 cat $i/Make.oldconfig.err
....@@ -55,19 +57,45 @@
5557 cat $i/Warnings
5658 fi
5759 else
58
- if test -f "$i/qemu-cmd"
59
- then
60
- print_bug qemu failed
61
- echo " $i"
62
- elif test -f "$i/buildonly"
60
+ if test -f "$i/buildonly"
6361 then
6462 echo Build-only run, no boot/test
6563 configcheck.sh $i/.config $i/ConfigFragment
6664 parse-build.sh $i/Make.out $configfile
65
+ elif test -f "$i/qemu-cmd"
66
+ then
67
+ print_bug qemu failed
68
+ echo " $i"
6769 else
6870 print_bug Build failed
6971 echo " $i"
7072 fi
7173 fi
7274 done
75
+ if test -f "$rd/kcsan.sum"
76
+ then
77
+ if grep -q CONFIG_KCSAN=y $T
78
+ then
79
+ echo "Compiler or architecture does not support KCSAN!"
80
+ echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'?
81
+ elif test -s "$rd/kcsan.sum"
82
+ then
83
+ echo KCSAN summary in $rd/kcsan.sum
84
+ else
85
+ echo Clean KCSAN run in $rd
86
+ fi
87
+ fi
7388 done
89
+EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1
90
+ret=$?
91
+builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`"
92
+if test "$builderrors" -gt 0
93
+then
94
+ echo $builderrors runs with build errors.
95
+fi
96
+runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`"
97
+if test "$runerrors" -gt 0
98
+then
99
+ echo $runerrors runs with runtime errors.
100
+fi
101
+exit $ret