Commit | Line | Data |
---|---|---|
c87b9c60 | 1 | #!/bin/bash |
fef141f6 | 2 | # SPDX-License-Identifier: GPL-2.0+ |
c87b9c60 | 3 | # |
02736b81 | 4 | # Given the results directories for previous KVM-based torture runs, |
c87b9c60 PM |
5 | # check the build and console output for errors. Given a directory |
6 | # containing results directories, this recursively checks them all. | |
7 | # | |
3327d924 | 8 | # Usage: kvm-recheck.sh resdir ... |
c87b9c60 | 9 | # |
63b29eae PM |
10 | # Returns status reflecting the success or not of the last run specified. |
11 | # | |
c87b9c60 PM |
12 | # Copyright (C) IBM Corporation, 2011 |
13 | # | |
fef141f6 | 14 | # Authors: Paul E. McKenney <paulmck@linux.ibm.com> |
c87b9c60 | 15 | |
40baf39f | 16 | T="`mktemp ${TMPDIR-/tmp}/kvm-recheck.sh.XXXXXX`" |
c0b94ffb PM |
17 | trap 'rm -f $T' 0 2 |
18 | ||
cd1955d0 PM |
19 | configerrors=0 |
20 | ||
c87b9c60 | 21 | PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH |
feef2d28 | 22 | . functions.sh |
c87b9c60 PM |
23 | for rd in "$@" |
24 | do | |
1219c863 | 25 | firsttime=1 |
c87b9c60 PM |
26 | dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u` |
27 | for i in $dirs | |
28 | do | |
43e38ab3 | 29 | if test -n "$firsttime" |
1219c863 | 30 | then |
43e38ab3 | 31 | firsttime="" |
1219c863 PM |
32 | resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'` |
33 | head -1 $resdir/log | |
34 | fi | |
8e3b180e | 35 | TORTURE_SUITE="`cat $i/../torture_suite`" ; export TORTURE_SUITE |
61251d68 | 36 | configfile=`echo $i | sed -e 's,^.*/,,'` |
cd1955d0 | 37 | rm -f $i/console.log.*.diags $i/ConfigFragment.diags |
98bb264b PM |
38 | case "${TORTURE_SUITE}" in |
39 | X*) | |
40 | ;; | |
41 | *) | |
42 | kvm-recheck-${TORTURE_SUITE}.sh $i | |
43 | esac | |
7dedfd43 | 44 | if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137 |
c87b9c60 | 45 | then |
7dedfd43 PM |
46 | echo QEMU error, output: |
47 | cat $i/qemu-output | |
48 | elif test -f "$i/console.log" | |
49 | then | |
50 | if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137 | |
51 | then | |
52 | echo QEMU killed | |
53 | fi | |
cd1955d0 | 54 | configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1 |
adec4880 PM |
55 | if grep -q '^CONFIG_KCSAN=y$' $i/ConfigFragment.input |
56 | then | |
57 | # KCSAN forces a number of Kconfig options, so remove | |
58 | # complaints about those Kconfig options in KCSAN runs. | |
59 | mv $i/ConfigFragment.diags $i/ConfigFragment.diags.kcsan | |
60 | grep -v -E 'CONFIG_PROVE_RCU|CONFIG_PREEMPT_COUNT' $i/ConfigFragment.diags.kcsan > $i/ConfigFragment.diags | |
61 | fi | |
cd1955d0 PM |
62 | if test -s $i/ConfigFragment.diags |
63 | then | |
64 | cat $i/ConfigFragment.diags | |
65 | configerrors=$((configerrors+1)) | |
66 | else | |
67 | rm $i/ConfigFragment.diags | |
68 | fi | |
8ba8b664 PM |
69 | if test -r $i/Make.oldconfig.err |
70 | then | |
71 | cat $i/Make.oldconfig.err | |
72 | fi | |
9eb97fe7 | 73 | parse-build.sh $i/Make.out $configfile |
9eb97fe7 PM |
74 | parse-console.sh $i/console.log $configfile |
75 | if test -r $i/Warnings | |
76 | then | |
77 | cat $i/Warnings | |
78 | fi | |
79 | else | |
6bcaf2a0 | 80 | if test -f "$i/buildonly" |
9bee2c6f PM |
81 | then |
82 | echo Build-only run, no boot/test | |
cd1955d0 PM |
83 | configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1 |
84 | if test -s $i/ConfigFragment.diags | |
85 | then | |
86 | cat $i/ConfigFragment.diags | |
87 | configerrors=$((configerrors+1)) | |
88 | else | |
89 | rm $i/ConfigFragment.diags | |
90 | fi | |
9bee2c6f | 91 | parse-build.sh $i/Make.out $configfile |
6bcaf2a0 PM |
92 | elif test -f "$i/qemu-cmd" |
93 | then | |
94 | print_bug qemu failed | |
95 | echo " $i" | |
9eb97fe7 PM |
96 | else |
97 | print_bug Build failed | |
9bee2c6f | 98 | echo " $i" |
9eb97fe7 | 99 | fi |
c87b9c60 PM |
100 | fi |
101 | done | |
10cec0de PM |
102 | if test -f "$rd/kcsan.sum" |
103 | then | |
cd1955d0 | 104 | if ! test -f $i/ConfigFragment.diags |
2ab5bbc3 PM |
105 | then |
106 | : | |
cd1955d0 | 107 | elif grep -q CONFIG_KCSAN=y $i/ConfigFragment.diags |
61b77be0 PM |
108 | then |
109 | echo "Compiler or architecture does not support KCSAN!" | |
110 | echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'? | |
111 | elif test -s "$rd/kcsan.sum" | |
10cec0de PM |
112 | then |
113 | echo KCSAN summary in $rd/kcsan.sum | |
114 | else | |
115 | echo Clean KCSAN run in $rd | |
116 | fi | |
117 | fi | |
c87b9c60 | 118 | done |
cd1955d0 PM |
119 | |
120 | if test "$configerrors" -gt 0 | |
121 | then | |
122 | echo $configerrors runs with .config errors. | |
123 | ret=1 | |
124 | fi | |
c0b94ffb | 125 | EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1 |
c0b94ffb PM |
126 | builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`" |
127 | if test "$builderrors" -gt 0 | |
128 | then | |
129 | echo $builderrors runs with build errors. | |
cd1955d0 | 130 | ret=2 |
c0b94ffb PM |
131 | fi |
132 | runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`" | |
133 | if test "$runerrors" -gt 0 | |
134 | then | |
135 | echo $runerrors runs with runtime errors. | |
cd1955d0 | 136 | ret=3 |
c0b94ffb PM |
137 | fi |
138 | exit $ret |