Skip to content

Commit 4b66054

Browse files
authored
fix(test_harness): kill job on timeout and check signal for failure on job completion (#388)
* fix(test_harness): also check signal on job completion This is to catch test runs where the process exits erroneously, for example via a SIGABRT. * fix(test_harness): kill spawned job on timeout
1 parent 5ab4f43 commit 4b66054

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

lua/plenary/test_harness.lua

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,18 @@ function harness.test_directory(directory, opts)
130130
j:start()
131131
if opts.sequential then
132132
log.debug("... Sequential wait for job number", i)
133-
Job.join(j, opts.timeout)
134-
log.debug("... Completed job number", i)
135-
if j.code ~= 0 then
133+
if not Job.join(j, opts.timeout) then
134+
log.debug("... Timed out job number", i)
136135
failure = true
137-
if not opts.keep_going then
138-
break
139-
end
136+
pcall(function()
137+
j.handle:kill(15) -- SIGTERM
138+
end)
139+
else
140+
log.debug("... Completed job number", i, j.code, j.signal)
141+
failure = j.code ~= 0 or j.signal ~= 0
142+
end
143+
if failure and not opts.keep_going then
144+
break
140145
end
141146
end
142147
end

0 commit comments

Comments
 (0)