check-all-fish-files: don't glob the entire worktree

Commit 22c0054c1e (Add check to test all fish files with -n, 2020-02-17)
added a test that runs "fish --no-execute" on all fish files in share/**.fish

Commit 329cd7d429 (Make functions, completions and tests resilient to
running on an embed-data fish, 2025-03-25) change this to run it on **.fish.

Evidently "the tests are exempt because they contain syntax errors" is no
longer true - this is because we have since changed those files to recursively
run 'fish -c "syntax-error"', which makes it easier to test for multiple
syntax-errors in a single test file. Remove the comment.

Globbing everything seems a bit crass, and there's no explicit
motivation.

	$ time find -name '*.fish' >/dev/null
	Executed in  431.93 millis
	$ time find * -name '*.fish' >/dev/null
	Executed in   39.98 millis

Let's go back to testing only directories where we currently have Git-tracked
fish files.  This makes uncached "check-all-fish-files.fish" go from 26
seconds to 5 seconds.
This commit is contained in:
Johannes Altmanninger
2025-06-09 08:46:31 +02:00
parent 138c6c4c40
commit 5346d3d491

View File

@@ -1,17 +1,15 @@
#RUN: fish=%fish %fish %s
# disable on CI ASAN because it's suuuper slow
#REQUIRES: test -z "$FISH_CI_SAN"
# Test ALL THE FISH FILES
# in share/, that is - the tests are exempt because they contain syntax errors, on purpose
set -l dir (path resolve -- (status dirname)/../../)
set timestamp_file $dir/tests/.last-check-all-files
set -l root (path resolve -- (status dirname)/../../)
set timestamp_file $root/tests/.last-check-all-files
set -l find_args
if test -f $timestamp_file
set find_args -newer $timestamp_file
end
set -l fail_count 0
for file in (find $dir -name "*.fish" $find_args)
for file in (find $root/{benchmarks,build_tools,etc,share,tests} -name "*.fish" $find_args)
$fish -n $file; or set fail_count (math $fail_count + 1)
end