From 6a2c5a7dd5c9215cc030d5ea6e4616d782c091dd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 8 Apr 2020 21:50:25 +0200 Subject: patch 8.2.0533: tests using term_wait() can still be flaky 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. --- src/testdir/term_util.vim | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/testdir/term_util.vim') 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 -- cgit v1.2.3