aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/autocmd/termclose_spec.lua25
1 files changed, 15 insertions, 10 deletions
diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua
index 9918cbe4fa..0804579a4f 100644
--- a/test/functional/autocmd/termclose_spec.lua
+++ b/test/functional/autocmd/termclose_spec.lua
@@ -1,3 +1,4 @@
+local luv = require('luv')
local helpers = require('test.functional.helpers')(after_each)
local clear, command, nvim, nvim_dir =
@@ -39,13 +40,15 @@ describe('TermClose event', function()
.. [[ 'on_exit': {-> execute('let g:test_job_exited = 1')}}) ]])
retry(nil, nil, function() eq(1, eval('get(g:, "test_job_started", 0)')) end)
- local start = os.time()
+ luv.update_time()
+ local start = luv.now()
command('call jobstop(g:test_job)')
retry(nil, nil, function() eq(1, eval('get(g:, "test_job_exited", 0)')) end)
- local duration = os.time() - start
- -- nvim starts sending SIGTERM after KILL_TIMEOUT_MS
- ok(duration >= 2)
- ok(duration <= 4) -- <= 2 + delta because of slow CI
+ luv.update_time()
+ local duration = luv.now() - start
+ -- Nvim begins SIGTERM after KILL_TIMEOUT_MS.
+ ok(duration >= 2000)
+ ok(duration <= 4000) -- Epsilon for slow CI
end)
it('kills pty job trapping SIGHUP and SIGTERM', function()
@@ -58,13 +61,15 @@ describe('TermClose event', function()
.. [[ 'on_exit': {-> execute('let g:test_job_exited = 1')}}) ]])
retry(nil, nil, function() eq(1, eval('get(g:, "test_job_started", 0)')) end)
- local start = os.time()
+ luv.update_time()
+ local start = luv.now()
command('call jobstop(g:test_job)')
retry(nil, nil, function() eq(1, eval('get(g:, "test_job_exited", 0)')) end)
- local duration = os.time() - start
- -- nvim starts sending kill after 2*KILL_TIMEOUT_MS
- ok(duration >= 4)
- ok(duration <= 7) -- <= 4 + delta because of slow CI
+ luv.update_time()
+ local duration = luv.now() - start
+ -- Nvim begins SIGKILL after (2 * KILL_TIMEOUT_MS).
+ ok(duration >= 4000)
+ ok(duration <= 7000) -- Epsilon for slow CI
end)
it('reports the correct <abuf>', function()