aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2017-12-29 21:13:21 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-12-30 22:49:50 +0100
commit46f432074e739a0eca9bb204e9c7769935669dbd (patch)
treedfe1a7953a75aaf7e0e10dcc1571dcbc15119c33
parenta30242d661b16197328859c50e609862011c9d48 (diff)
downloadrneovim-46f432074e739a0eca9bb204e9c7769935669dbd.tar.gz
rneovim-46f432074e739a0eca9bb204e9c7769935669dbd.tar.bz2
rneovim-46f432074e739a0eca9bb204e9c7769935669dbd.zip
tests: termclose_spec: fix flaky SIGTERM test #7787
Followup to https://github.com/neovim/neovim/pull/7217. Build failure: https://travis-ci.org/neovim/neovim/jobs/322930672#L2958.
-rw-r--r--src/nvim/window.c15
-rw-r--r--test/functional/autocmd/termclose_spec.lua9
2 files changed, 14 insertions, 10 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2e1507c0ee..b687781dfb 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -2104,25 +2104,26 @@ void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
if (tp->tp_firstwin == tp->tp_lastwin) {
char_u prev_idx[NUMBUFLEN];
if (has_event(EVENT_TABCLOSED)) {
- vim_snprintf((char *)prev_idx, NUMBUFLEN, "%i", tabpage_index(tp));
+ vim_snprintf((char *)prev_idx, NUMBUFLEN, "%i", tabpage_index(tp));
}
- if (tp == first_tabpage)
+ if (tp == first_tabpage) {
first_tabpage = tp->tp_next;
- else {
+ } else {
for (ptp = first_tabpage; ptp != NULL && ptp->tp_next != tp;
- ptp = ptp->tp_next)
- ;
+ ptp = ptp->tp_next) {
+ // loop
+ }
if (ptp == NULL) {
internal_error("win_close_othertab()");
return;
}
ptp->tp_next = tp->tp_next;
}
- free_tp = TRUE;
+ free_tp = true;
if (has_event(EVENT_TABCLOSED)) {
- apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, win->w_buffer);
+ apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, win->w_buffer);
}
}
diff --git a/test/functional/autocmd/termclose_spec.lua b/test/functional/autocmd/termclose_spec.lua
index c6c30494dd..e64df502a6 100644
--- a/test/functional/autocmd/termclose_spec.lua
+++ b/test/functional/autocmd/termclose_spec.lua
@@ -4,6 +4,7 @@ local clear, command, nvim, nvim_dir =
helpers.clear, helpers.command, helpers.nvim, helpers.nvim_dir
local eval, eq, retry =
helpers.eval, helpers.eq, helpers.retry
+local ok = helpers.ok
if helpers.pending_win32(pending) then return end
@@ -41,7 +42,9 @@ describe('TermClose event', function()
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
- eq(2, duration)
+ -- nvim starts sending SIGTERM after KILL_TIMEOUT_MS
+ ok(duration >= 2)
+ ok(duration <= 4) -- <= 2 + delta because of slow CI
end)
it('kills pty job trapping SIGHUP and SIGTERM', function()
@@ -58,8 +61,8 @@ describe('TermClose event', function()
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
- helpers.ok(4 <= duration)
- helpers.ok(duration <= 7) -- <= 4 + delta because of slow CI
+ ok(duration >= 4)
+ ok(duration <= 7) -- <= 4 + delta because of slow CI
end)
it('reports the correct <abuf>', function()