mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 06:34:01 +08:00
Pass all check files to littlecheck at once
Instead of invoking littlecheck.py independently for each file, pass all files at once. This amortizes the Python startup cost, and reduces the total test time by ~15 seconds (!).
This commit is contained in:
parent
11c1491e5a
commit
5f0c698601
|
@ -71,39 +71,26 @@ end
|
||||||
|
|
||||||
set -g python (__fish_anypython)
|
set -g python (__fish_anypython)
|
||||||
|
|
||||||
function test_littlecheck_file
|
# Test classic '.in' files.
|
||||||
set -l file $argv[1]
|
set -l failed 0
|
||||||
echo -n "Testing file $file ... "
|
for i in (string match '*.in' -- $files_to_test)
|
||||||
set starttime (timestamp)
|
if not test_in_file $i
|
||||||
|
set failed (math $failed + 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test littlecheck files.
|
||||||
|
set littlecheck_files (string match '*.fish' -- $files_to_test)
|
||||||
|
if set -q littlecheck_files[1]
|
||||||
$python -S ../littlecheck.py \
|
$python -S ../littlecheck.py \
|
||||||
|
--progress \
|
||||||
-s fish=../test/root/bin/fish \
|
-s fish=../test/root/bin/fish \
|
||||||
-s fish_test_helper=../test/root/bin/fish_test_helper \
|
-s fish_test_helper=../test/root/bin/fish_test_helper \
|
||||||
$file
|
$littlecheck_files
|
||||||
set -l exit_status $status
|
set -l littlecheck_failures $status
|
||||||
set -l res ok
|
set failed (math $failed + $littlecheck_failures)
|
||||||
set test_duration (delta $starttime)
|
|
||||||
if test $exit_status -eq 0
|
|
||||||
say green "ok ($test_duration $unit)"
|
|
||||||
end
|
|
||||||
return $exit_status
|
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l failed
|
|
||||||
for i in $files_to_test
|
|
||||||
if string match --quiet '*.fish' $i
|
|
||||||
if not test_littlecheck_file $i
|
|
||||||
# littlecheck test
|
|
||||||
set failed $failed $i
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# .in test
|
|
||||||
if not test_in_file $i
|
|
||||||
set failed $failed $i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set failed (count $failed)
|
|
||||||
if test $failed -eq 0
|
if test $failed -eq 0
|
||||||
say green "All tests completed successfully"
|
say green "All tests completed successfully"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user