summaryrefslogtreecommitdiffstats
path: root/src/testdir/term_util.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-08 21:50:25 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-08 21:50:25 +0200
commit6a2c5a7dd5c9215cc030d5ea6e4616d782c091dd (patch)
treec3c2d559b959ba7b6776212f5e071683b8079a96 /src/testdir/term_util.vim
parent7035fd9d909c49cf5105a53753c1772c193d05b8 (diff)
patch 8.2.0533: tests using term_wait() can still be flakyv8.2.0533
Problem: Tests using term_wait() can still be flaky. Solution: Increase the wait time when rerunning a test. (James McCoy, closes #5899) Halve the initial times to make tests run faster when there is no rerun.
Diffstat (limited to 'src/testdir/term_util.vim')
-rw-r--r--src/testdir/term_util.vim17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/testdir/term_util.vim b/src/testdir/term_util.vim
index 32e2889140..715a4ac760 100644
--- a/src/testdir/term_util.vim
+++ b/src/testdir/term_util.vim
@@ -24,6 +24,21 @@ func StopShellInTerminal(buf)
call WaitFor({-> job_status(job) == "dead"})
endfunc
+" Wrapper around term_wait() to allow more time for re-runs of flaky tests
+" The second argument is the minimum time to wait in msec, 10 if omitted.
+func TermWait(buf, ...)
+ let wait_time = a:0 ? a:1 : 10
+ if g:run_nr == 2
+ let wait_time *= 4
+ elseif g:run_nr > 2
+ let wait_time *= 10
+ endif
+ call term_wait(a:buf, wait_time)
+
+ " In case it wasn't set yet.
+ let g:test_is_flaky = 1
+endfunc
+
" Run Vim with "arguments" in a new terminal window.
" By default uses a size of 20 lines and 75 columns.
" Returns the buffer number of the terminal.
@@ -82,7 +97,7 @@ func RunVimInTerminal(arguments, options)
let cols = term_getsize(buf)[1]
endif
- call term_wait(buf)
+ call TermWait(buf)
" Wait for "All" or "Top" of the ruler to be shown in the last line or in
" the status line of the last window. This can be quite slow (e.g. when