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