mirror of
https://github.com/neovim/neovim.git
synced 2026-05-25 06:18:32 +00:00
test: run Lua harness with nvim -l
Problem: The Lua test harness still ran through standalone -ll mode, so tests depended on the low-level Lua path instead of the regular Nvim Lua environment. That also meant os.exit() coverage had to carry an ASAN workaround because Lua's raw process exit skipped Nvim teardown and let LeakSanitizer interfere with the observed exit code. Solution: Run the harness and related fixtures with nvim -l. Patch os.exit() in the main Lua state to exit through getout(), so scripts observe normal Nvim shutdown while standalone -ll remains available for generator-style scripts. As a consequence, the startup test can assert os.exit() without disabling leak detection. AI-assisted: Codex
This commit is contained in:
committed by
Lewis Russell
parent
706cbbff33
commit
9432e6c1e2
@@ -27,9 +27,15 @@ end
|
||||
local root = repo_root()
|
||||
prepend_package_roots({ root, root .. '/test', '.', './test' })
|
||||
|
||||
-- The harness is not an Nvim instance under test. If its startup server stays
|
||||
-- visible, serverlist({ peer = true }) can connect back to the runner and wait
|
||||
-- forever for an RPC response.
|
||||
if vim.v.servername ~= '' then
|
||||
assert(vim.fn.serverstop(vim.v.servername) == 1)
|
||||
end
|
||||
|
||||
local exit_code = require('test.harness').main(_G.arg)
|
||||
io.stdout:flush()
|
||||
io.stderr:flush()
|
||||
|
||||
-- Close the standalone Lua state before exit so sanitizers see Lua-owned cleanup.
|
||||
os.exit(exit_code, true)
|
||||
os.exit(exit_code)
|
||||
|
||||
Reference in New Issue
Block a user