forked from aniani/vim
patch 9.1.0820: tests: Mac OS tests are too flaky
Problem: tests: Mac OS tests are too flaky Solution: Increase max test timeout to 25 minutes, allow up to 10 retries on Mac OS runners, refactor runtest.vim (Milly). closes: #15940 Co-authored-by: K.Takata <kentkt@csc.jp> Signed-off-by: Milly <milly.ca@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
1e2007e643
commit
baab7c0865
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -389,7 +389,7 @@ jobs:
|
|||||||
brew install diffutils
|
brew install diffutils
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
timeout-minutes: 20
|
timeout-minutes: 25
|
||||||
run: |
|
run: |
|
||||||
make ${TEST}
|
make ${TEST}
|
||||||
|
|
||||||
|
@@ -190,10 +190,6 @@ function GetAllocId(name)
|
|||||||
return lnum - top - 1
|
return lnum - top - 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
if has('reltime')
|
|
||||||
let g:func_start = reltime()
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Get the list of swap files in the current directory.
|
" Get the list of swap files in the current directory.
|
||||||
func s:GetSwapFileList()
|
func s:GetSwapFileList()
|
||||||
let save_dir = &directory
|
let save_dir = &directory
|
||||||
@@ -603,6 +599,16 @@ for g:testfunc in sort(s:tests)
|
|||||||
" A test can set g:test_is_flaky to retry running the test.
|
" A test can set g:test_is_flaky to retry running the test.
|
||||||
let g:test_is_flaky = 0
|
let g:test_is_flaky = 0
|
||||||
|
|
||||||
|
" A test can set g:max_run_nr to change the max retry count.
|
||||||
|
let g:max_run_nr = 5
|
||||||
|
if has('mac')
|
||||||
|
let g:max_run_nr = 10
|
||||||
|
endif
|
||||||
|
|
||||||
|
" By default, give up if the same error occurs. A test can set
|
||||||
|
" g:giveup_same_error to 0 to not give up on the same error and keep trying.
|
||||||
|
let g:giveup_same_error = 1
|
||||||
|
|
||||||
let starttime = strftime("%H:%M:%S")
|
let starttime = strftime("%H:%M:%S")
|
||||||
call RunTheTest(g:testfunc)
|
call RunTheTest(g:testfunc)
|
||||||
|
|
||||||
@@ -618,10 +624,15 @@ for g:testfunc in sort(s:tests)
|
|||||||
call extend(s:messages, v:errors)
|
call extend(s:messages, v:errors)
|
||||||
|
|
||||||
let endtime = strftime("%H:%M:%S")
|
let endtime = strftime("%H:%M:%S")
|
||||||
call add(total_errors, $'Run {g:run_nr}, {starttime} - {endtime}:')
|
if has('reltime')
|
||||||
|
let suffix = $' in{reltimestr(reltime(g:func_start))} seconds'
|
||||||
|
else
|
||||||
|
let suffix = ''
|
||||||
|
endif
|
||||||
|
call add(total_errors, $'Run {g:run_nr}, {starttime} - {endtime}{suffix}:')
|
||||||
call extend(total_errors, v:errors)
|
call extend(total_errors, v:errors)
|
||||||
|
|
||||||
if g:run_nr >= 5 || prev_error == v:errors[0]
|
if g:run_nr >= g:max_run_nr || g:giveup_same_error && 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
|
||||||
@@ -632,7 +643,8 @@ for g:testfunc in sort(s:tests)
|
|||||||
" Flakiness is often caused by the system being very busy. Sleep a
|
" Flakiness is often caused by the system being very busy. Sleep a
|
||||||
" couple of seconds to have a higher chance of succeeding the second
|
" couple of seconds to have a higher chance of succeeding the second
|
||||||
" time.
|
" time.
|
||||||
sleep 2
|
let delay = g:run_nr * 2
|
||||||
|
exe 'sleep' delay
|
||||||
|
|
||||||
let prev_error = v:errors[0]
|
let prev_error = v:errors[0]
|
||||||
let v:errors = []
|
let v:errors = []
|
||||||
|
@@ -56,6 +56,7 @@ func VerifyScreenDump(buf, filename, options, ...)
|
|||||||
|
|
||||||
" Starting a terminal to make a screendump is always considered flaky.
|
" Starting a terminal to make a screendump is always considered flaky.
|
||||||
let g:test_is_flaky = 1
|
let g:test_is_flaky = 1
|
||||||
|
let g:giveup_same_error = 0
|
||||||
|
|
||||||
" wait for the pending updates to be handled.
|
" wait for the pending updates to be handled.
|
||||||
call TermWait(a:buf)
|
call TermWait(a:buf)
|
||||||
@@ -83,41 +84,55 @@ func VerifyScreenDump(buf, filename, options, ...)
|
|||||||
sleep 50m
|
sleep 50m
|
||||||
call delete(testfile)
|
call delete(testfile)
|
||||||
call term_dumpwrite(a:buf, testfile, a:options)
|
call term_dumpwrite(a:buf, testfile, a:options)
|
||||||
|
|
||||||
|
if refdump->empty()
|
||||||
|
let msg = 'See new dump file: call term_dumpload("testdir/' .. testfile .. '")'
|
||||||
|
call assert_report(msg)
|
||||||
|
" no point in retrying
|
||||||
|
let g:run_nr = 10
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
let testdump = ReadAndFilter(testfile, filter)
|
let testdump = ReadAndFilter(testfile, filter)
|
||||||
if refdump == testdump
|
if refdump == testdump
|
||||||
call delete(testfile)
|
call delete(testfile)
|
||||||
if did_mkdir
|
if did_mkdir
|
||||||
call delete('failed', 'd')
|
call delete('failed', 'd')
|
||||||
endif
|
endif
|
||||||
|
if i > 0
|
||||||
|
call remove(v:errors, -1)
|
||||||
|
endif
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
if i == max_loops
|
|
||||||
" Leave the failed dump around for inspection.
|
" Leave the failed dump around for inspection.
|
||||||
if filereadable(reference)
|
let msg = 'See dump file difference: call term_dumpdiff("testdir/' .. testfile .. '", "testdir/' .. reference .. '")'
|
||||||
let msg = 'See dump file difference: call term_dumpdiff("testdir/' .. testfile .. '", "testdir/' .. reference .. '")'
|
if a:0 == 1
|
||||||
if a:0 == 1
|
let msg = a:1 . ': ' . msg
|
||||||
let msg = a:1 . ': ' . msg
|
endif
|
||||||
endif
|
if len(testdump) != len(refdump)
|
||||||
if len(testdump) != len(refdump)
|
let msg = msg . '; line count is ' . len(testdump) . ' instead of ' . len(refdump)
|
||||||
let msg = msg . '; line count is ' . len(testdump) . ' instead of ' . len(refdump)
|
endif
|
||||||
endif
|
for j in range(len(refdump))
|
||||||
else
|
if j >= len(testdump)
|
||||||
let msg = 'See new dump file: call term_dumpload("testdir/' .. testfile .. '")'
|
break
|
||||||
" no point in retrying
|
|
||||||
let g:run_nr = 10
|
|
||||||
endif
|
endif
|
||||||
for i in range(len(refdump))
|
if testdump[j] != refdump[j]
|
||||||
if i >= len(testdump)
|
let msg = msg . '; difference in line ' . (j + 1) . ': "' . testdump[j] . '"'
|
||||||
break
|
endif
|
||||||
endif
|
endfor
|
||||||
if testdump[i] != refdump[i]
|
|
||||||
let msg = msg . '; difference in line ' . (i + 1) . ': "' . testdump[i] . '"'
|
" Always add the last error so that it is displayed on timeout.
|
||||||
endif
|
" See TestTimeout() in runtest.vim.
|
||||||
endfor
|
if i > 0
|
||||||
call assert_report(msg)
|
call remove(v:errors, -1)
|
||||||
|
endif
|
||||||
|
call assert_report(msg)
|
||||||
|
|
||||||
|
let i += 1
|
||||||
|
if i >= max_loops
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
let i += 1
|
|
||||||
endwhile
|
endwhile
|
||||||
return 0
|
return 0
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -2762,6 +2762,8 @@ func LspTests(port)
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_channel_lsp_mode()
|
func Test_channel_lsp_mode()
|
||||||
|
" The channel lsp mode test is flaky and gives the same error.
|
||||||
|
let g:giveup_same_error = 0
|
||||||
call RunServer('test_channel_lsp.py', 'LspTests', [])
|
call RunServer('test_channel_lsp.py', 'LspTests', [])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
820,
|
||||||
/**/
|
/**/
|
||||||
819,
|
819,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user