mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.0454: some tests fail when the system is slow
Problem: Some tests fail when the system is slow. Solution: Make the run number global, use in the test to increase the waiting time. (closes #5841)
This commit is contained in:
@@ -406,7 +406,7 @@ for s:test in sort(s:tests)
|
|||||||
set belloff=all
|
set belloff=all
|
||||||
let prev_error = ''
|
let prev_error = ''
|
||||||
let total_errors = []
|
let total_errors = []
|
||||||
let run_nr = 1
|
let g:run_nr = 1
|
||||||
|
|
||||||
" A test can set test_is_flaky to retry running the test.
|
" A test can set test_is_flaky to retry running the test.
|
||||||
let test_is_flaky = 0
|
let test_is_flaky = 0
|
||||||
@@ -423,10 +423,10 @@ for s:test in sort(s:tests)
|
|||||||
call add(s:messages, 'Found errors in ' . s:test . ':')
|
call add(s:messages, 'Found errors in ' . s:test . ':')
|
||||||
call extend(s:messages, v:errors)
|
call extend(s:messages, v:errors)
|
||||||
|
|
||||||
call add(total_errors, 'Run ' . run_nr . ':')
|
call add(total_errors, 'Run ' . g:run_nr . ':')
|
||||||
call extend(total_errors, v:errors)
|
call extend(total_errors, v:errors)
|
||||||
|
|
||||||
if run_nr == 5 || prev_error == v:errors[0]
|
if g:run_nr == 5 || prev_error == v:errors[0]
|
||||||
call add(total_errors, 'Flaky test failed too often, giving up')
|
call add(total_errors, 'Flaky test failed too often, giving up')
|
||||||
let v:errors = total_errors
|
let v:errors = total_errors
|
||||||
break
|
break
|
||||||
@@ -441,7 +441,7 @@ for s:test in sort(s:tests)
|
|||||||
|
|
||||||
let prev_error = v:errors[0]
|
let prev_error = v:errors[0]
|
||||||
let v:errors = []
|
let v:errors = []
|
||||||
let run_nr += 1
|
let g:run_nr += 1
|
||||||
|
|
||||||
call RunTheTest(s:test)
|
call RunTheTest(s:test)
|
||||||
|
|
||||||
|
@@ -1832,6 +1832,17 @@ endfunc
|
|||||||
func Test_state()
|
func Test_state()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
" In the first run try a short wait time. If the test fails retry with a
|
||||||
|
" longer wait time.
|
||||||
|
if g:run_nr == 1
|
||||||
|
let wait_time = 50
|
||||||
|
elseif g:run_nr == 2
|
||||||
|
let wait_time = 200
|
||||||
|
else
|
||||||
|
let wait_time = 500
|
||||||
|
endif
|
||||||
|
let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
|
||||||
|
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
call setline(1, ['one', 'two', 'three'])
|
call setline(1, ['one', 'two', 'three'])
|
||||||
map ;; gg
|
map ;; gg
|
||||||
@@ -1851,28 +1862,27 @@ func Test_state()
|
|||||||
|
|
||||||
" Using a timer callback
|
" Using a timer callback
|
||||||
call term_sendkeys(buf, ":call RunTimer()\<CR>")
|
call term_sendkeys(buf, ":call RunTimer()\<CR>")
|
||||||
call term_wait(buf, 50)
|
call term_wait(buf, wait_time)
|
||||||
let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"
|
|
||||||
call term_sendkeys(buf, getstate)
|
call term_sendkeys(buf, getstate)
|
||||||
call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
" Halfway a mapping
|
" Halfway a mapping
|
||||||
call term_sendkeys(buf, ":call RunTimer()\<CR>;")
|
call term_sendkeys(buf, ":call RunTimer()\<CR>;")
|
||||||
call term_wait(buf, 50)
|
call term_wait(buf, wait_time)
|
||||||
call term_sendkeys(buf, ";")
|
call term_sendkeys(buf, ";")
|
||||||
call term_sendkeys(buf, getstate)
|
call term_sendkeys(buf, getstate)
|
||||||
call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
" Insert mode completion (bit slower on Mac)
|
" Insert mode completion (bit slower on Mac)
|
||||||
call term_sendkeys(buf, ":call RunTimer()\<CR>Got\<C-N>")
|
call term_sendkeys(buf, ":call RunTimer()\<CR>Got\<C-N>")
|
||||||
call term_wait(buf, 200)
|
call term_wait(buf, wait_time)
|
||||||
call term_sendkeys(buf, "\<Esc>")
|
call term_sendkeys(buf, "\<Esc>")
|
||||||
call term_sendkeys(buf, getstate)
|
call term_sendkeys(buf, getstate)
|
||||||
call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
" Autocommand executing
|
" Autocommand executing
|
||||||
call term_sendkeys(buf, ":set filetype=foobar\<CR>")
|
call term_sendkeys(buf, ":set filetype=foobar\<CR>")
|
||||||
call term_wait(buf, 50)
|
call term_wait(buf, wait_time)
|
||||||
call term_sendkeys(buf, getstate)
|
call term_sendkeys(buf, getstate)
|
||||||
call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000)
|
||||||
|
|
||||||
@@ -1880,7 +1890,7 @@ func Test_state()
|
|||||||
|
|
||||||
" messages scrolled
|
" messages scrolled
|
||||||
call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>")
|
call term_sendkeys(buf, ":call RunTimer()\<CR>:echo \"one\\ntwo\\nthree\"\<CR>")
|
||||||
call term_wait(buf, 50)
|
call term_wait(buf, wait_time)
|
||||||
call term_sendkeys(buf, "\<CR>")
|
call term_sendkeys(buf, "\<CR>")
|
||||||
call term_sendkeys(buf, getstate)
|
call term_sendkeys(buf, getstate)
|
||||||
call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000)
|
call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000)
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
454,
|
||||||
/**/
|
/**/
|
||||||
453,
|
453,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user