check: print elapsed time even for failed tests
PATCH 1/1 check: print elapsed time even for failed tests
Sometimes it's useful to see how long the test runs. The time is calculated the same way as in the normal case but the time is not stored in the $tmp.time file.
--- check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
check +1 -1
@@ -755,7 +755,7 @@ for section in $HOST_OPTIONS_SECTIONS; do fi echo "" else - echo " - output mismatch (see $seqres.out.bad)" + echo " `expr $stop - $start`s - output mismatch (see $seqres.out.bad)" mv $tmp.out $seqres.out.bad $diff $seq.out $seqres.out.bad | { if test "$DIFF_LENGTH" -le 0; then
Signature · 1 line
2.14.0
Quoted 14 lines · David Sterba
Sometimes it's useful to see how long the test runs. The time is calculated the same way as in the normal case but the time is not stored in the $tmp.time file.
Signed-off-by David Sterba <[email protected]>--- check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)check +0
-0
check for section in $HOST_OPTIONS_SECTIONS; do · line 758
Quoted 5 lines
check +1
-1@@ -755,7 +755,7 @@ for section in $HOST_OPTIONS_SECTIONS; do fi echo "" else - echo " - output mismatch (see $seqres.out.bad)" + echo " `expr $stop - $start`s - output mismatch (see $seqres.out.bad)"
This only prints out test time in the output mismatch case, there's another 'exit with nonzero' failure case needs the test time too.
I did the following updates based on your patch and it worked for me for both failure cases, can you please take a look and verify too? I can fold this update to your patch if it looks fine to you.
---
check +11 -10
@@ -729,18 +729,12 @@ for section in $HOST_OPTIONS_SECTIONS; do n_notrun=`expr $n_notrun + 1` tc_status="notrun" else - if [ $sts -ne 0 ] - then - err_msg="[failed, exit status $sts]" - echo -n " $err_msg" - err=true - fi if [ ! -f $seq.out ] then _dump_err "no qualified output" err=true else - + testtime=`expr $stop - $start` # coreutils 8.16+ changed quote formats in error messages from # `foo' to 'foo'. Filter old versions to match the new version. sed -i "s/\`/\'/g" $tmp.out
@@ -750,12 +744,19 @@ for section in $HOST_OPTIONS_SECTIONS; do then : else - echo "$seqnum `expr $stop - $start`" >>$tmp.time - echo -n " `expr $stop - $start`s" + if [ $sts -ne 0 ] + then + err_msg="[failed, exit status $sts]" + echo -n " ${testtime}s $err_msg" + err=true + else + echo "$seqnum $testtime" >>$tmp.time + echo -n " ${testtime}s" + fi fi echo "" else - echo " `expr $stop - $start`s - output mismatch (see $seqres.out.bad)" + echo " ${testtime}s - output mismatch (see $seqres.out.bad)" mv $tmp.out $seqres.out.bad $diff $seq.out $seqres.out.bad | { if test "$DIFF_LENGTH" -le 0; then
---
Thanks,
Eryu