patch 9.2.0396: tests: Test_error_callback_terminal is flaky on macOS
Commit:
https://github.com/vim/vim/commit/2baef82cd104639d5a0d57941afdc961ce52ccb2
Author: Yasuhiro Matsumoto <[email protected]>
Date: Sun Apr 26 09:22:38 2026 +0000
patch 9.2.0396: tests: Test_error_callback_terminal is flaky on macOS
Problem: tests: Test_error_callback_terminal is flaky on macOS
Solution: Use WaitForAssert() to make it more reliable
(Yasuhiro Matsumoto).
term_wait() only waits for terminal screen updates and does not
guarantee that the err_io 'pipe' callback has fired, so on macOS
the assert_match() against g:error frequently runs before sh has
written "sh: XXXX: not found", causing the test to flake.
Replace term_wait() + assert_match() with WaitForAssert() so each
assertion polls until the callback delivers the expected output.
Also defer sending "exit" until the stderr message has been seen,
to avoid losing the stderr write to the exit race.
closes: #20075
Signed-off-by: Yasuhiro Matsumoto <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 23f8a0fc3..ceb553263 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2922,11 +2922,11 @@ func Test_error_callback_terminal()
call assert_equal('RAW', dict.err_mode)
call assert_equal('pipe', dict.err_io)
call term_sendkeys(buf, "XXXX\<cr>")
- call term_wait(buf)
+ " term_wait() does not wait for the err_io 'pipe' callback to fire, so use
+ " WaitForAssert() to poll until sh has written the error message.
+ call WaitForAssert({-> assert_match('sh:.*XXXX:.*not found', g:error)}, 5000)
call term_sendkeys(buf, "exit\<cr>")
- call term_wait(buf)
- call assert_match('XXX.*exit', g:out)
- call assert_match('sh:.*XXXX:.*not found', g:error)
+ call WaitForAssert({-> assert_match('XXX.*exit', g:out)}, 5000)
delfunc s:Out
delfunc s:Err
diff --git a/src/version.c b/src/version.c
index 369938147..e714ddc2a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 396,
/**/
395,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wH0Un-002MJ5-VO%40256bit.org.