mirror of
https://github.com/neovim/neovim.git
synced 2026-05-29 16:25:35 +00:00
test: flaky terminal channel exitcode check #39580
Problem: The `nvim_get_chan_info()` terminal channel test used `shell-test INTERACT` to verify that `jobstop()` reports an unhandled `SIGHUP` as exit code `129`. `INTERACT` reads from stdin with `fgets()`, so closing the PTY could race with `SIGHUP` delivery. If `fgets()` observed EOF first, `shell-test` exited normally with code `0`, causing intermittent failures on slower sanitizer builds. Solution: Add a `shell-test HOLD` mode that prints a readiness prompt and then waits without reading stdin. Use it for the `SIGHUP` assertion so PTY EOF cannot make the helper exit normally before the signal path is observed.
This commit is contained in:
@@ -2977,9 +2977,10 @@ describe('API', function()
|
||||
|
||||
-- :terminal with args + stopped process (shell-test).
|
||||
command('enew')
|
||||
argv = { n.testprg('shell-test'), 'INTERACT' }
|
||||
-- Use a process that doesn't read stdin, so PTY EOF can't race SIGHUP.
|
||||
argv = { n.testprg('shell-test'), 'HOLD' }
|
||||
fn.jobstart(argv, { term = true })
|
||||
screen:expect({ any = { vim.pesc('interact $') } })
|
||||
screen:expect({ any = { vim.pesc('holding $') } })
|
||||
eq(1, eval('jobstop(&channel)'))
|
||||
eval('jobwait([&channel], 1000)') -- Wait.
|
||||
local expected3 = term_channel_info(5, 3, argv)
|
||||
|
||||
Reference in New Issue
Block a user