Check tmux-multiline-prompt failure
I am using the fish-git AUR package to install fish master branch. But the check tmux-multiline-prompt fails after commit https://github.com/fish-shell/fish-shell/commit/2dbaf10c3613aeff1e473c9717ff622ca555968b. More specific, the new repainint test fails the check. It may be a problem of my environment, because I have tried to test it in a clean root and it passed. Here's some information of my environment:
$ fish --version
fish, version 3.7.1-2414-g5b249dbb4
$ uname -a
Linux pc-lan 6.11.5-arch1-1.1 #1 SMP PREEMPT_DYNAMIC Wed, 23 Oct 2024 00:18:24 +0000 x86_64 GNU/Linux
$ echo $TERM
alacritty
Could you tell me how to investigate this? Not familiar with the test framework, but after reading some of the test codes, fish and tmux seems to be isolated in a temp environment. So the test outputs should be the same in both my environment and a clean root.
Here's the verbose failed test log:
$ env FISH_FORCE_COLOR=1 FISH_SOURCE_DIR=/home/jax/repos/jax/fish-shell /usr/bin/ctest --force-new-ctest-process --output-on-failure --progress -I 130,130 -V
UpdateCTestConfiguration from :/home/jax/repos/jax/fish-shell/build/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/jax/repos/jax/fish-shell/build/DartConfiguration.tcl
Test project /home/jax/repos/jax/fish-shell/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 130
Start 130: tmux-multiline-prompt.fish
130: Test command: /usr/bin/sh "/home/jax/repos/jax/fish-shell/build/tests/test_driver.sh" "/home/jax/repos/jax/fish-shell/build/tests/test.fish" "tmux-multiline-prompt"
130: Working Directory: /home/jax/repos/jax/fish-shell/build/tests
130: Environment variables:
130: FISH_FORCE_COLOR=1
130: Test timeout computed to be: 10000000
130: Testing file checks/tmux-multiline-prompt.fish ... Failure:
130:
130: The CHECK on line 58 wants:
130: prompt-line-2> echo Hello World
130:
130: which failed to match line stdout:8:
130: prompt-line-2> : 1
130:
130: additional output on stderr:1:13:
130: no current client
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130: not in a mode
130:
130: Context:
130: [...] from line 45 (stdout:3):
130: prompt-line-1
130: prompt-line-2>
130: prompt-line-1
130: prompt-line-2> : 1 <= does not match CHECK on line 58: prompt-line-2> echo Hello World
130: prompt-line-1 <= does not match CHECK on line 59: Hello World
130: prompt-line-2> : 3 <= no check matches this, previous check on line 59
130: prompt-line-1 <= no check matches this, previous check on line 59
130: prompt-line-2> : 5 <= no check matches this, previous check on line 59
130: prompt-line-1
130: prompt-line-2>
130: prompt-line-1 <= no more checks
130: prompt-line-2>
130:
130: when running command:
130: ../test/root/bin/fish checks/tmux-multiline-prompt.fish
1/1 Test #130: tmux-multiline-prompt.fish .......***Failed 2.77 sec
Testing file checks/tmux-multiline-prompt.fish ... Failure:
The CHECK on line 58 wants:
prompt-line-2> echo Hello World
which failed to match line stdout:8:
prompt-line-2> : 1
additional output on stderr:1:13:
no current client
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
not in a mode
Context:
[...] from line 45 (stdout:3):
prompt-line-1
prompt-line-2>
prompt-line-1
prompt-line-2> : 1 <= does not match CHECK on line 58: prompt-line-2> echo Hello World
prompt-line-1 <= does not match CHECK on line 59: Hello World
prompt-line-2> : 3 <= no check matches this, previous check on line 59
prompt-line-1 <= no check matches this, previous check on line 59
prompt-line-2> : 5 <= no check matches this, previous check on line 59
prompt-line-1
prompt-line-2>
prompt-line-1 <= no more checks
prompt-line-2>
when running command:
../test/root/bin/fish checks/tmux-multiline-prompt.fish
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 2.77 sec
The following tests FAILED:
130 - tmux-multiline-prompt.fish (Failed)
Errors while running CTest
The no current client and not in a mode stderr outputs looks suspicious, I can confirm they are all produced by this two lines in tmux-multiline-prompt.fish:
isolated-tmux send-keys 'bind ctrl-r "echo | less +q; commandline \'echo Hello World\'"' Enter C-l \
isolated-tmux send-keys C-r
I'll add some better info later. Maybe fish crashed, or something is wrong with tmux.
Unfortunately this test framework hides some fatal error message, we should really fix that. I think last time I looked at tmux server logs (by injecting -vv somewhere in isolated-tmux-start).
FWIW one can run the tmux tests outside the test framework. This is a workaround for the fact that the test framework doesn't give us a tty
build/fish -C 'source tests/test_functions/isolated-tmux-start.fish' tests/checks/tmux-multiline-prompt.fish
using that I sometimes insert tmux attach into the test script. But your case sounds like the whole tmux session already exited so this probably won't work.
@krobelus Thanks for your reply. I've tried the workaround and saved tmux logs. But it's very verbose, and it's hard for me to find useful information in it. So I attach logs here, hope it helps. tmp.vv.tar.gz
does this work for you? If yes, bisect the difference in your env vars:
env -i PATH=(string join : $PATH) ninja -C build test_tmux-multiline-prompt.fish
1729947989.073748 cmd_pack_argv: argv[0]=new-session 1729947989.073750 cmd_pack_argv: argv[1]=-x 1729947989.073751 cmd_pack_argv: argv[2]=80 1729947989.073751 cmd_pack_argv: argv[3]=-y 1729947989.073752 cmd_pack_argv: argv[4]=10 1729947989.073753 cmd_pack_argv: argv[5]=-d 1729947989.073754 cmd_pack_argv: argv[6]=/home/jax/repos/jax/fish-shell/build/fish 1729947989.073755 cmd_pack_argv: argv[7]=-C 1729947989.073769 cmd_pack_argv: argv[8]=\n # This is similar to "tests/interactive.config".\n function fish_greeting; end\n function fish_prompt; printf "prompt $status_generation> "; end\n # No autosuggestion from older history.\n set fish_history ""\n 1729947989.073771 sending message 200 to peer 0x5e49f59b68b0 (323 bytes) 1729947989.073772 client loop enter 1729947989.073781 client_signal: Child exited
This sounds like fish exited immediately.
Can you try running the test with this patch applied, then you should see any crash output.
Alternatively, try coredumpctl; if it crashed, it should have created a core dump that you can examine using coredumpctl gdb.
diff --git a/tests/test_functions/isolated-tmux-start.fish b/tests/test_functions/isolated-tmux-start.fish
index 2956400abf..4c7fb3ae3b 100644
--- a/tests/test_functions/isolated-tmux-start.fish
+++ b/tests/test_functions/isolated-tmux-start.fish
@@ -20,6 +20,7 @@
end
function isolated-tmux-cleanup --on-event fish_exit --inherit-variable tmpdir
+ cat stderr >&2
isolated-tmux kill-server
rm -r $tmpdir
end
@@ -30,7 +31,7 @@
end
set -l fish (status fish-path)
- isolated-tmux new-session -x 80 -y 10 -d $fish -C '
+ isolated-tmux new-session -x 80 -y 10 -d sh -c '"$@" 2>stderr' -- $fish -i -C '
# This is similar to "tests/interactive.config".
function fish_greeting; end
function fish_prompt; printf "prompt $status_generation> "; end
It turns out that the EDITOR=nvim in my envs causes this problem. Unsetting it or setting it a non-existed command passes the test. And setting it to vi or vim still fails the test.
I've tried the patch, but it didn't give more information. And coredumpctl, don't know if I use it right. After the test fail, coredumpctl list ./build/fish outputs nothing.
Setting EDITOR=nvim should reproduce the same failure. I've tried it in this container, Its Dockerfile:
FROM archlinux:base-devel
RUN pacman -Syu --noconfirm \
ncurses \
pcre2 \
cargo \
cmake \
python-sphinx \
expect \
procps-ng \
tmux \
less
Inside the container, commands to reproduce:
curl -OL 'https://github.com/fish-shell/fish-shell/archive/2e2765eec02e62308814012b39c91088dd026b12.tar.gz'
tar xvf *.tar.gz
cd fish-shell*
cmake -B build
make -C build
env EDITOR=nvim make -C build test
great work, thanks
In hindsight, another way of figuring this out would have been to run tmux new-session fish and run (or type) the send-keys manually, then it would probably have been obvious that tmux send-keys Escape does nothing and we're in the wrong mode for subsequent keys. Of course the test framework should be improved
Now I can update fish normally, thanks @krobelus.