tests: Specifically #require fish_test_helper when needed

This commit is contained in:
Fabian Boehm 2024-12-26 13:30:09 +01:00
parent 63e705a778
commit b531cc8b43
13 changed files with 27 additions and 1 deletions

View file

@ -1,4 +1,5 @@
# RUN: env fish_test_helper=%fish_test_helper %fish %s
#REQUIRES: command -v %fish_test_helper
# Ensure that a job which attempts to disown itself does not explode.
# Here fish_test_helper is the process group leader; we attempt to disown

View file

@ -1,4 +1,5 @@
# RUN: %fish -C "set helper %fish_test_helper" %s
#REQUIRES: command -v %fish_test_helper
# Check that we don't leave stray FDs.

View file

@ -1,4 +1,5 @@
#RUN: env fth=%fish_test_helper fish=%fish %fish %s
#REQUIRES: command -v %fish_test_helper
# Ensure job control works in non-interactive environments.

View file

@ -1,4 +1,5 @@
# RUN: env fth=%fish_test_helper fish=%fish %fish %s
#REQUIRES: command -v %fish_test_helper
status job-control full

View file

@ -1,4 +1,5 @@
#RUN: %fish -C "set -g helper %fish_test_helper; set -g fish %fish" %s
#REQUIRES: command -v %fish_test_helper
# Check that nohup is propagated.
set output_path (mktemp)

View file

@ -1,6 +1,7 @@
#RUN: %fish -C "set helper %fish_test_helper" %s
# This hangs on OpenBSD
#REQUIRES: test "$(uname)" != OpenBSD
#REQUIRES: command -v %fish_test_helper
# Command subs run in same pgroup as fish, even if job control is 'all'.
# Verify that they get the same pgroup across runs (presumably fish's).

View file

@ -1,4 +1,5 @@
# RUN: env fish_test_helper=%fish_test_helper %fish -C 'set -l fish %fish' %s
#REQUIRES: command -v %fish_test_helper
$fish -c 'function main; exit 4; true; end; main'
echo $status

View file

@ -1,4 +1,5 @@
# RUN: env fth=%fish_test_helper %fish %s
#REQUIRES: command -v %fish_test_helper
set -g SIGUSR1_COUNT 0

View file

@ -36,7 +36,8 @@ function test_pexpect_file
set -lx --prepend PYTHONPATH (realpath $PWD)
set -lx fish $FISHDIR/fish
set -lx fish_key_reader $FISHDIR/fish_key_reader
set -lx fish_test_helper $FISHDIR/fish_test_helper
path is -fx -- $FISHDIR/fish_test_helper
and set -lx fish_test_helper $FISHDIR/fish_test_helper
# Note we require Python3.
python3 $file

View file

@ -26,6 +26,9 @@ fish_pid = sp.spawn.pid
# Launch fish_test_helper.
expect_prompt()
exe_path = os.environ.get("fish_test_helper")
if not exe_path:
sys.exit(127)
sp.sendline(exe_path + " nohup_wait")
# We expect it to transfer tty ownership to fish_test_helper.

View file

@ -2,6 +2,7 @@
from pexpect_helper import SpawnedProc
import platform
import subprocess
import os
sp = SpawnedProc()
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
@ -75,6 +76,10 @@ expect_prompt()
sendline("jobs")
expect_prompt("jobs: There are no jobs")
if not os.environ.get("fish_test_helper", ""):
import sys
sys.exit(127)
# Regression test for #2214: foregrounding from a key binding works!
sendline(r"bind ctrl-r 'fg >/dev/null 2>/dev/null'")
expect_prompt()

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3
from pexpect_helper import SpawnedProc
import os
sp = SpawnedProc()
send, sendline, expect_prompt, expect_str = (
@ -13,6 +14,10 @@ expect_prompt()
sendline("function echo_wrap ; /bin/echo $argv ; sleep 0.1; end")
expect_prompt()
if not os.environ.get("fish_test_helper", ""):
import sys
sys.exit(127)
for i in range(5):
sendline(
"echo_wrap 1 2 3 4 | $fish_test_helper become_foreground_then_print_stderr ; or exit 1"

View file

@ -12,6 +12,10 @@ send, sendline, expect_prompt, expect_str, sleep = (
sp.sleep,
)
if not os.environ.get("fish_test_helper", ""):
import sys
sys.exit(127)
# Launch fish_test_helper.
expect_prompt()
exe_path = os.environ.get("fish_test_helper")