Make tests usable with path with spaces
This is somewhat subtle:
The #RUN line in a littlecheck file will be run by a posix shell,
which means the substitutions will also be mangled by it.
Now, we *have* shell-quoted them, but unfortunately what we need is to
quote them for inside a pre-existing layer of quotes, e.g.
# RUN: fish -C 'set -g fish %fish'
here, %fish can't be replaced with `'path with spaces/fish'`, because
that ends up as
# RUN: fish -C 'set -g fish 'path with spaces/fish''
which is just broken.
So instead, we pass it as a variable to that fish:
# RUN: fish=%fish fish...
In addition, we need to not mangle the arguments in our test_driver.
For that, because we insist on posix shell, which has only one array,
and we source a file, we *need* to stop having that file use
arguments.
Which is okay - test_env.sh could previously be used to start a test,
and now it no longer can because that is test_*driver*.sh's job.
For the interactive tests, it's slightly different:
pexpect.spawn(foo) is sensitive to shell metacharacters like space.
So we shell-quote it.
But if you pass any args to pexpect.spawn, it no longer uses a shell,
and so we cannot shell-quote it.
There could be a better way to fix this?
2024-12-27 19:54:43 +00:00
|
|
|
#RUN: fish=%fish %fish %s
|
2024-04-25 19:52:13 +00:00
|
|
|
# disable on CI ASAN because it's suuuper slow
|
|
|
|
#REQUIRES: test -z "$FISH_CI_SAN"
|
2020-02-17 14:31:47 +00:00
|
|
|
# Test ALL THE FISH FILES
|
|
|
|
# in share/, that is - the tests are exempt because they contain syntax errors, on purpose
|
|
|
|
|
Revert "Revert "Speed up check-all-fish-files when executed locally""
This reverts commit e240d81ff841a86294e9e0e6b26bf42a1b4c18ed 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.
2021-03-06 23:07:24 +00:00
|
|
|
set timestamp_file ./last_check_all_files
|
|
|
|
set -l find_args
|
|
|
|
if test -f $timestamp_file
|
|
|
|
set find_args -newer $timestamp_file
|
2021-03-06 04:40:40 +00:00
|
|
|
end
|
Revert "Revert "Speed up check-all-fish-files when executed locally""
This reverts commit e240d81ff841a86294e9e0e6b26bf42a1b4c18ed 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.
2021-03-06 23:07:24 +00:00
|
|
|
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
|
|
|
|
|
2020-02-17 14:31:47 +00:00
|
|
|
# No output is good output
|