From 5346d3d491a4f2379b8f35869d810b396cd62526 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 9 Jun 2025 08:46:31 +0200 Subject: [PATCH] check-all-fish-files: don't glob the entire worktree Commit 22c0054c1e9 (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 329cd7d4297 (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. --- tests/checks/check-all-fish-files.fish | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/checks/check-all-fish-files.fish b/tests/checks/check-all-fish-files.fish index 0035e5352..083675239 100644 --- a/tests/checks/check-all-fish-files.fish +++ b/tests/checks/check-all-fish-files.fish @@ -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