]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
check: simplify check.time parsing
authorDavid Disseldorp <ddiss@suse.de>
Mon, 20 Jun 2022 19:29:30 +0000 (21:29 +0200)
committerZorro Lang <zlang@kernel.org>
Fri, 24 Jun 2022 15:15:03 +0000 (23:15 +0800)
There's no need to use grep and awk when the latter can do all that's
needed, including the pretty printing.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
check

diff --git a/check b/check
index 42925e09f687172436dba4b54eaf59927ef76915..43c072d2eff381a4732cabd52aa863178b3a3bf9 100755 (executable)
--- a/check
+++ b/check
@@ -819,13 +819,9 @@ function run_section()
                try="$try $seqnum"
                n_try=`expr $n_try + 1`
 
-               # slashes now in names, sed barfs on them so use grep
-               lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
-               if [ "X$lasttime" != X ]; then
-                       echo -n " ${lasttime}s ... "
-               else
-                       echo -n "       " # prettier output with timestamps.
-               fi
+               awk 'BEGIN {lasttime="       "} \
+                    $1 == "'$seqnum'" {lasttime=" " $2 "s ... "; exit} \
+                    END {printf "%s", lasttime}' "$check.time"
                rm -f core $seqres.notrun
 
                start=`_wallclock`