From 598e98794c3af753b57d385c7b81d0063eed41e0 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 11 Oct 2025 15:31:14 +0200 Subject: [PATCH] Fixes for tmux-fish_config.fish This fails sometimes in high-concurrency scenarios (build_tools/check.sh), so allow sleeping a bit longer. --- tests/checks/tmux-fish_config.fish | 3 ++- tests/test_functions/isolated-tmux-start.fish | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/checks/tmux-fish_config.fish b/tests/checks/tmux-fish_config.fish index cb7b46dc9..e88aea46d 100644 --- a/tests/checks/tmux-fish_config.fish +++ b/tests/checks/tmux-fish_config.fish @@ -15,7 +15,7 @@ isolated-tmux-start isolated-tmux resize-window -x 500 isolated-tmux send-keys "BROWSER=true fish_config" Enter -tmux-sleep +sleep-until 'isolated-tmux capture-pane -p | grep ENTER' isolated-tmux capture-pane -p # CHECK: prompt 0> BROWSER=true fish_config # CHECK: Web config started at file://{{.*}}.html @@ -24,6 +24,7 @@ isolated-tmux capture-pane -p # Extract the URL from the output set -l base_url (isolated-tmux capture-pane -p | string match -r 'http://localhost:\d{4}/\w+/$') +or exit set -l host_port (dirname $base_url) # Check a bad URL (http://host:port/invalid_auth/) diff --git a/tests/test_functions/isolated-tmux-start.fish b/tests/test_functions/isolated-tmux-start.fish index c1db91393..faddeff3f 100644 --- a/tests/test_functions/isolated-tmux-start.fish +++ b/tests/test_functions/isolated-tmux-start.fish @@ -26,6 +26,19 @@ function isolated-tmux-start or sleep 0.3 end + function sleep-until + set -l cmd $argv[1] + set -l i 0 + while [ $i -lt 100 ] && not eval "$cmd" >/dev/null + tmux-sleep + set i (math $i + 1) + end + if [ $i -eq 100 ] + printf '%s\n' "timeout waiting for $cmd" >&2 + exit 1 + end + end + set -l fish (status fish-path) isolated-tmux new-session -x 80 -y 10 -d $fish -C ' # This is similar to "tests/interactive.config".