rcutorture: Make kvm-recheck-rcu.sh handle truncated lines
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 14 Feb 2020 22:43:44 +0000 (14:43 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 27 Apr 2020 18:05:13 +0000 (11:05 -0700)
System hangs or killed rcutorture guest OSes can result in truncated
"Reader Pipe:" lines, which can in turn result in false-positive
reader-batch near-miss warnings.  This commit therefore adjusts the
reader-batch checks to account for possible line truncation.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcu.sh

index 9d9a416..1706cd4 100755 (executable)
@@ -41,7 +41,21 @@ else
                title="$title ($ngpsps/s)"
        fi
        echo $title $stopstate $fwdprog
-       nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
+       nclosecalls=`grep --binary-files=text 'torture: Reader Batch' $i/console.log | tail -1 | \
+               awk -v sum=0 '
+               {
+                       for (i = 0; i <= NF; i++) {
+                               sum += $i;
+                               if ($i ~ /Batch:/) {
+                                       sum = 0;
+                                       i = i + 2;
+                               }
+                       }
+               }
+
+               END {
+                       print sum
+               }'`
        if test -z "$nclosecalls"
        then
                exit 0