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-28 03:54:43 +08:00
|
|
|
#RUN: fish=%fish helper=%fish_test_helper %fish %s
|
2024-12-26 20:30:09 +08:00
|
|
|
#REQUIRES: command -v %fish_test_helper
|
2019-10-16 13:33:53 +08:00
|
|
|
|
2020-08-11 03:26:30 +08:00
|
|
|
# Check that nohup is propagated.
|
|
|
|
set output_path (mktemp)
|
|
|
|
nohup $fish -c "$helper print_ignored_signals" 2>&1 > $output_path
|
|
|
|
cat $output_path
|
|
|
|
# CHECK: Hangup: 1
|
|
|
|
rm $output_path
|
2020-04-05 16:24:26 +08:00
|
|
|
|
2020-08-11 03:26:30 +08:00
|
|
|
# Block some signals if job control is off (#6828).
|
2020-04-05 16:24:26 +08:00
|
|
|
status job-control none
|
|
|
|
for fish_use_posix_spawn in 0 1
|
|
|
|
$helper print_blocked_signals &
|
|
|
|
wait
|
|
|
|
end
|
|
|
|
# CHECKERR: Interrupt: 2
|
|
|
|
# CHECKERR: Quit: 3
|
|
|
|
# CHECKERR: Interrupt: 2
|
|
|
|
# CHECKERR: Quit: 3
|
|
|
|
|
2019-10-16 13:33:53 +08:00
|
|
|
# Ensure we can break from a while loop.
|
|
|
|
|
|
|
|
echo About to sigint
|
|
|
|
$helper sigint_parent &
|
2020-01-14 03:34:22 +08:00
|
|
|
while true
|
|
|
|
end
|
2019-10-16 13:33:53 +08:00
|
|
|
echo I should not be printed because I got sigint
|
|
|
|
|
|
|
|
#CHECK: About to sigint
|
|
|
|
#CHECKERR: Sent SIGINT to {{\d*}}
|