Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / tools / testing / selftests / rcutorture / bin / kvm-find-errors.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0+
3 #
4 # Invoke a text editor on all console.log files for all runs with diagnostics,
5 # that is, on all such files having a console.log.diags counterpart.
6 # Note that both console.log.diags and console.log are passed to the
7 # editor (currently defaulting to "vi"), allowing the user to get an
8 # idea of what to search for in the console.log file.
9 #
10 # Usage: kvm-find-errors.sh directory
11 #
12 # The "directory" above should end with the date/time directory, for example,
13 # "tools/testing/selftests/rcutorture/res/2018.02.25-14:27:27".
14 #
15 # Copyright (C) IBM Corporation, 2018
16 #
17 # Author: Paul E. McKenney <paulmck@linux.ibm.com>
18
19 rundir="${1}"
20 if test -z "$rundir" -o ! -d "$rundir"
21 then
22         echo Usage: $0 directory
23 fi
24 editor=${EDITOR-vi}
25
26 # Find builds with errors
27 files=
28 for i in ${rundir}/*/Make.out
29 do
30         if egrep -q "error:|warning:" < $i
31         then
32                 egrep "error:|warning:" < $i > $i.diags
33                 files="$files $i.diags $i"
34         fi
35 done
36 if test -n "$files"
37 then
38         $editor $files
39 else
40         echo No build errors.
41 fi
42 if grep -q -e "--buildonly" < ${rundir}/log
43 then
44         echo Build-only run, no console logs to check.
45 fi
46
47 # Find console logs with errors
48 files=
49 for i in ${rundir}/*/console.log
50 do
51         if test -r $i.diags
52         then
53                 files="$files $i.diags $i"
54         fi
55 done
56 if test -n "$files"
57 then
58         $editor $files
59 else
60         echo No errors in console logs.
61 fi