[tip:core/rcu] rcutorture: Flag errors and warnings with color coding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  6d40cc0cb4311d0c5aa4a106cc86a3d45a9ad86c
Gitweb:     http://git.kernel.org/tip/6d40cc0cb4311d0c5aa4a106cc86a3d45a9ad86c
Author:     Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
AuthorDate: Mon, 28 Oct 2013 06:34:22 -0700
Committer:  Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
CommitDate: Tue, 3 Dec 2013 10:11:18 -0800

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@xxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Cc: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 tools/testing/selftests/rcutorture/bin/functions.sh    | 16 ++++++++++++++++
 .../testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh |  5 ++---
 tools/testing/selftests/rcutorture/bin/parse-build.sh  | 18 ++++++++++++++----
 .../testing/selftests/rcutorture/bin/parse-console.sh  |  4 +++-
 .../selftests/rcutorture/bin/parse-rcutorture.sh       | 10 ++++++----
 5 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
index d0d19eb..963b6f0 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -134,6 +134,22 @@ identify_qemu_vcpus () {
 	lscpu | grep '^CPU(s):' | sed -e 's/CPU(s)://'
 }
 
+# print_bug
+#
+# Prints "BUG: " in red followed by remaining arguments
+print_bug () {
+	printf '\033[031mBUG: \033[m'
+	echo $*
+}
+
+# print_warning
+#
+# Prints "WARNING: " in yellow followed by remaining arguments
+print_warning () {
+	printf '\033[033mWARNING: \033[m'
+	echo $*
+}
+
 # specify_qemu_cpus qemu-cmd qemu-args #cpus
 #
 # Appends a string containing "-smp XXX" to qemu-args, unless the incoming
diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
index 3df1581..46f97d3 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-rcu.sh
@@ -188,6 +188,5 @@ then
 fi
 
 cp $builddir/console.log $resdir
-parse-rcutorture.sh $resdir/console.log $title >> $resdir/Warnings 2>&1
-parse-console.sh $resdir/console.log $title >> $resdir/Warnings 2>&1
-cat $resdir/Warnings
+parse-rcutorture.sh $resdir/console.log $title
+parse-console.sh $resdir/console.log $title
diff --git a/tools/testing/selftests/rcutorture/bin/parse-build.sh b/tools/testing/selftests/rcutorture/bin/parse-build.sh
index 2e0e9f7..9da2c7b 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-build.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-build.sh
@@ -30,18 +30,28 @@
 T=$1
 title=$2
 
+. functions.sh
+
 if grep -q CC < $T
 then
 	:
 else
-	echo $title no build
+	print_bug $title no build
 	exit 1
 fi
 
-if egrep -q "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
+if grep -q "error:" < $T
+then
+	print_bug $title build errors:
+	grep "error:" < $T
+	exit 2
+fi
+exit 0
+
+if egrep -q "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
 then
-	echo $title build errors:
-	egrep "error:|rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
+	print_warning $title build errors:
+	egrep "rcu[^/]*\.c.*warning:|rcu.*\.h.*warning:" < $T
 	exit 2
 fi
 exit 0
diff --git a/tools/testing/selftests/rcutorture/bin/parse-console.sh b/tools/testing/selftests/rcutorture/bin/parse-console.sh
index bc1496f..8f4be78 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-console.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-console.sh
@@ -31,9 +31,11 @@ trap 'rm -f $T' 0
 file="$1"
 title="$2"
 
+. functions.sh
+
 egrep 'Badness|WARNING:|Warn|BUG|===========|Call Trace:|Oops:' < $file | grep -v 'ODEBUG: ' | grep -v 'Warning: unable to open an initial console' > $T
 if test -s $T
 then
-	echo Assertion failure in $file $title
+	print_warning Assertion failure in $file $title
 	cat $T
 fi
diff --git a/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh b/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
index 37368a0..ac2f75a 100755
--- a/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
+++ b/tools/testing/selftests/rcutorture/bin/parse-rcutorture.sh
@@ -34,6 +34,8 @@ title="$2"
 
 trap 'rm -f $T.seq' 0
 
+. functions.sh
+
 # check for presence of rcutorture.txt file
 
 if test -f "$file" -a -r "$file"
@@ -49,7 +51,7 @@ fi
 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
 then
 	nerrs=`grep --binary-files=text '!!!' $file | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
-	echo $title FAILURE, $nerrs instances
+	print_bug $title FAILURE, $nerrs instances
 	echo "   " $url
 	exit
 fi
@@ -84,21 +86,21 @@ if grep -q SUCCESS $file
 then
 	if test -s $T.seq
 	then
-		echo WARNING $title `cat $T.seq`
+		print_warning $title $title `cat $T.seq`
 		echo "   " $file
 		exit 2
 	fi
 else
 	if grep -q RCU_HOTPLUG $file
 	then
-		echo WARNING: HOTPLUG FAILURES $title `cat $T.seq`
+		print_warning HOTPLUG FAILURES $title `cat $T.seq`
 		echo "   " $file
 		exit 3
 	fi
 	echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful RCU version messages
 	if test -s $T.seq
 	then
-		echo WARNING $title `cat $T.seq`
+		print_warning $title `cat $T.seq`
 	fi
 	exit 2
 fi
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux