Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcutorture: Flag errors and warnings with color coding

The output of the rcutorture scripts often requires interpretation, so
this commit simplifies this interpretation by tagging messages as
BUGs (colored red) or WARNINGs (colored yellow).

Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Greg KH <gregkh@linuxfoundation.org>

+41 -12
+16
tools/testing/selftests/rcutorture/bin/functions.sh
··· 134 134 lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://' 135 135 } 136 136 137 + # print_bug 138 + # 139 + # Prints "BUG: " in red followed by remaining arguments 140 + print_bug () { 141 + printf '\033[031mBUG: \033[m' 142 + echo $* 143 + } 144 + 145 + # print_warning 146 + # 147 + # Prints "WARNING: " in yellow followed by remaining arguments 148 + print_warning () { 149 + printf '\033[033mWARNING: \033[m' 150 + echo $* 151 + } 152 + 137 153 # specify_qemu_cpus qemu-cmd qemu-args #cpus 138 154 # 139 155 # Appends a string containing "-smp XXX" to qemu-args, unless the incoming
+2 -3
tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
··· 188 188 fi 189 189 190 190 cp $builddir/console.log $resdir 191 - parse-rcutorture.sh $resdir/console.log $title >> $resdir/Warnings 2>&1 192 - parse-console.sh $resdir/console.log $title >> $resdir/Warnings 2>&1 193 - cat $resdir/Warnings 191 + parse-rcutorture.sh $resdir/console.log $title 192 + parse-console.sh $resdir/console.log $title
+14 -4
tools/testing/selftests/rcutorture/bin/parse-build.sh
··· 30 30 T=$1 31 31 title=$2 32 32 33 + . functions.sh 34 + 33 35 if grep -q CC < $T 34 36 then 35 37 : 36 38 else 37 - echo $title no build 39 + print_bug $title no build 38 40 exit 1 39 41 fi 40 42 41 - if egrep -q "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T 43 + if grep -q "error:" < $T 42 44 then 43 - echo $title build errors: 44 - egrep "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T 45 + print_bug $title build errors: 46 + grep "error:" < $T 47 + exit 2 48 + fi 49 + exit 0 50 + 51 + if egrep -q "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T 52 + then 53 + print_warning $title build errors: 54 + egrep "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T 45 55 exit 2 46 56 fi 47 57 exit 0
+3 -1
tools/testing/selftests/rcutorture/bin/parse-console.sh
··· 31 31 file="$1" 32 32 title="$2" 33 33 34 + . functions.sh 35 + 34 36 egrep 'Badness|WARNING:|Warn|BUG|===========|Call Trace:|Oops:' < $file | grep -v 'ODEBUG: ' | grep -v 'Warning: unable to open an initial console' > $T 35 37 if test -s $T 36 38 then 37 - echo Assertion failure in $file $title 39 + print_warning Assertion failure in $file $title 38 40 cat $T 39 41 fi
+6 -4
tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
··· 34 34 35 35 trap 'rm -f $T.seq' 0 36 36 37 + . functions.sh 38 + 37 39 # check for presence of rcutorture.txt file 38 40 39 41 if test -f "$file" -a -r "$file" ··· 51 49 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file 52 50 then 53 51 nerrs=`grep --binary-files=text '!!!' $file | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'` 54 - echo $title FAILURE, $nerrs instances 52 + print_bug $title FAILURE, $nerrs instances 55 53 echo " " $url 56 54 exit 57 55 fi ··· 86 84 then 87 85 if test -s $T.seq 88 86 then 89 - echo WARNING $title `cat $T.seq` 87 + print_warning $title $title `cat $T.seq` 90 88 echo " " $file 91 89 exit 2 92 90 fi 93 91 else 94 92 if grep -q RCU_HOTPLUG $file 95 93 then 96 - echo WARNING: HOTPLUG FAILURES $title `cat $T.seq` 94 + print_warning HOTPLUG FAILURES $title `cat $T.seq` 97 95 echo " " $file 98 96 exit 3 99 97 fi 100 98 echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful RCU version messages 101 99 if test -s $T.seq 102 100 then 103 - echo WARNING $title `cat $T.seq` 101 + print_warning $title `cat $T.seq` 104 102 fi 105 103 exit 2 106 104 fi