mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Revert "Revert "Speed up check-all-fish-files when executed locally""
This reverts commit e240d81ff8
and
introduces a more compatible method of finding newly added fish scripts
to syntax check.
`find -newer` is the original and is supported by everything under the
sun (including FreeBSD, NetBSD, Solaris, OpenIndiana, macOS 10.10, WSL,
and more), and if not, the tests will succeed anyway. `find -mnewer` was
added later around the time `find -cnewer` and co (which checks the
creation date rather than the modification date) was introduced, but
apparently the GNU version of coreutils never introduced the `-mnewer`
alias for `-newer`.
Yes, this is hacky and yes it would be ideal if the build system is the
one that picked which tests to run rather than the test itself picking.
But let's not pretend that our tests are idealogically ideal or pure
right now and until we fix the mess that is our CMake test integration
(e.g. use ctest and configure each test to be run separately with
configurable payloads, etc) eight seconds is still eight seconds, and
again, the CI isn't affected.
This commit is contained in:
parent
e240d81ff8
commit
8a07db8e8f
1 changed files with 14 additions and 2 deletions
|
@ -2,7 +2,19 @@
|
||||||
# Test ALL THE FISH FILES
|
# Test ALL THE FISH FILES
|
||||||
# in share/, that is - the tests are exempt because they contain syntax errors, on purpose
|
# in share/, that is - the tests are exempt because they contain syntax errors, on purpose
|
||||||
|
|
||||||
for file in $__fish_data_dir/**.fish
|
set timestamp_file ./last_check_all_files
|
||||||
$fish -n $file
|
set -l find_args
|
||||||
|
if test -f $timestamp_file
|
||||||
|
set find_args -newer $timestamp_file
|
||||||
end
|
end
|
||||||
|
set -l fail_count 0
|
||||||
|
for file in (find $__fish_data_dir/ -name "*.fish" $find_args 2>/dev/null; or find $__fish_data_dir/ -name "*.fish")
|
||||||
|
$fish -n $file; or set fail_count (math $fail_count + 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Prevent setting timestamp if any errors were encountered
|
||||||
|
if test "$fail_count" -eq 0
|
||||||
|
touch $timestamp_file
|
||||||
|
end
|
||||||
|
|
||||||
# No output is good output
|
# No output is good output
|
||||||
|
|
Loading…
Reference in a new issue