test: improve Nvim EOF handling (for Windows CI) #40841

Problem:
Mysterious Windows CI failure points to resource exhaustion, but we have
no visibility/instrumentation:

    RUN      T610 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <S-Left>: 93.70 ms OK
    RUN      T611 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <F12><F2><Tab>: 49.48 ms FAIL
    …\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed.
    stack traceback:
            D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap'
            …/api/keymap_spec.lua:769: in function <…/api/keymap_spec.lua:768>
    RUN      T612 nvim_set_keymap, nvim_del_keymap can set mappings with special characters, lhs: <S-Left>, rhs: <Space><Tab>: 18.49 ms FAIL
    …\testnvim.lua:144: EOF was received from Nvim. Likely the Nvim process crashed.
    stack traceback:
            D:/a/neovim/neovim/test/functional/testnvim.lua:144: in function 'nvim_set_keymap'
            …/api/keymap_spec.lua:769: in function <.../build/Xtest_xdg_api/test/functional/api/keymap_spec.lua:768>

Solution:
Append the child exit-code and signal to the "EOF … crashed" message.

Example:

    Nvim EOF (crash?) exit code: 42 (0x0000002A)

On the next failing Windows run, the first crash line will classify the failure:
- 0xC0000005 → access violation (nvim bug)
- 0xC0000374 → heap corruption (nvim bug)
- spawn/resource error or "clean" exit-code → system resource exhaustion
This commit is contained in:
Justin M. Keyes
2026-07-19 12:45:40 -04:00
committed by GitHub
parent d1b3a9924d
commit 40ab941f79
2 changed files with 40 additions and 13 deletions

View File

@@ -9,7 +9,6 @@ local SocketStream = uv_stream.SocketStream
local ProcStream = uv_stream.ProcStream
local check_cores = t.check_cores
local pcall_err = t.pcall_err
local check_logs = t.check_logs
local dedent = t.dedent
local eq = t.eq
@@ -133,7 +132,7 @@ end
--- @return any
function M.request(method, ...)
assert(session, 'no Nvim session')
assert(not session.eof_err, 'sending request after EOF from Nvim')
assert(not session.eof_err, 'RPC request after Nvim EOF')
local status, rv = session:request(method, ...)
if not status then
if loop_running then
@@ -331,12 +330,11 @@ end
-- Use for commands which expect nvim to quit.
-- The first argument can also be a timeout.
function M.expect_exit(fn_or_timeout, ...)
local eof_err_msg = 'EOF was received from Nvim. Likely the Nvim process crashed.'
if type(fn_or_timeout) == 'function' then
t.matches(vim.pesc(eof_err_msg), t.pcall_err(fn_or_timeout, ...))
t.matches(vim.pesc(Session.eof_err_msg), t.pcall_err(fn_or_timeout, ...))
else
t.matches(
vim.pesc(eof_err_msg),
vim.pesc(Session.eof_err_msg),
t.pcall_err(function(timeout, fn, ...)
fn(...)
assert(session)