Report duration of each test

This commit is contained in:
ridiculousfish 2018-09-03 14:13:31 -07:00
parent 2a62e18635
commit 8e2d207869
2 changed files with 6 additions and 2 deletions

View file

@ -45,12 +45,14 @@ end
function test_file
set -l file $argv[1]
echo -n "Testing file $file ... "
set starttime (date +%s)
begin
set -lx TERM dumb
expect -n -c 'source interactive.expect.rc' -f $file >$file.tmp.out 2>$file.tmp.err
end
set -l exit_status $status
set -l res ok
set test_duration (math (date +%s) - $starttime)
mv -f interactive.tmp.log $file.tmp.log
diff $file.tmp.out $file.out >/dev/null
@ -59,7 +61,7 @@ function test_file
set -l err_status $status
if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0
say green "ok"
say green "ok ($test_duration sec)"
# clean up tmp files
rm -f $file.tmp.{err,out,log}
return 0

View file

@ -34,10 +34,12 @@ function test_file
set -l base (basename $file .in)
echo -n "Testing file $file ... "
set starttime (date +%s)
../test/root/bin/fish <$file >$base.tmp.out 2>$base.tmp.err
set -l exit_status $status
set -l res ok
set test_duration (math (date +%s) - $starttime)
diff $base.tmp.out $base.out >/dev/null
set -l out_status $status
@ -45,7 +47,7 @@ function test_file
set -l err_status $status
if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0
say green "ok"
say green "ok ($test_duration sec)"
# clean up tmp files
rm -f $base.tmp.{err,out}
return 0