mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-27 06:31:19 -03:00
tests: add a lame gdate-based ms-precision timer if installed
I got tired of seeing ' ... ok (0 sec)' so now with GNU date/gdate installed there is millisecond output shown. One can get rough nanoseconds from gdate.
This commit is contained in:
@@ -34,12 +34,12 @@ function test_in_file
|
||||
set -l base (basename $file .in)
|
||||
|
||||
echo -n "Testing file $file ... "
|
||||
set starttime (date +%s)
|
||||
set starttime (timestamp)
|
||||
|
||||
../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)
|
||||
set test_duration (delta $starttime)
|
||||
|
||||
diff $base.tmp.out $base.out >/dev/null
|
||||
set -l out_status $status
|
||||
@@ -47,7 +47,7 @@ function test_in_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 ($test_duration sec)"
|
||||
say green "ok ($test_duration $unit)"
|
||||
# clean up tmp files
|
||||
rm -f $base.tmp.{err,out}
|
||||
return 0
|
||||
@@ -74,13 +74,13 @@ set -g python (__fish_anypython)
|
||||
function test_littlecheck_file
|
||||
set -l file $argv[1]
|
||||
echo -n "Testing file $file ... "
|
||||
set starttime (date +%s)
|
||||
set starttime (timestamp)
|
||||
$python ../littlecheck.py -s fish=../test/root/bin/fish $file
|
||||
set -l exit_status $status
|
||||
set -l res ok
|
||||
set test_duration (math (date +%s) - $starttime)
|
||||
set test_duration (delta $starttime)
|
||||
if test $exit_status -eq 0
|
||||
say green "ok ($test_duration sec)"
|
||||
say green "ok ($test_duration $unit)"
|
||||
end
|
||||
return $exit_status
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user