Accomodate flaky tests that I can't diagnose
This commit is contained in:
parent
9e2526c4a4
commit
4ed9158282
3 changed files with 34 additions and 6 deletions
|
|
@ -87,3 +87,7 @@ func s:WaitForCommon(expr, assert, timeout)
|
|||
|
||||
return -1 " timed out
|
||||
endfunc
|
||||
|
||||
function! ThisTestIsFlaky()
|
||||
let g:test_is_flaky = v:true
|
||||
endfunction
|
||||
|
|
|
|||
|
|
@ -344,12 +344,6 @@ catch
|
|||
\ ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
|
||||
" Names of flaky tests.
|
||||
let s:flaky_tests = []
|
||||
|
||||
" Pattern indicating a common flaky test failure.
|
||||
let s:flaky_errors_re = '__does_not_match__'
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
redir @q
|
||||
silent function /^Test_
|
||||
|
|
@ -366,7 +360,33 @@ for s:test in sort(s:tests)
|
|||
" Silence, please!
|
||||
set belloff=all
|
||||
|
||||
" A test can set g:test_is_flaky to retry running the test.
|
||||
let g:test_is_flaky = 0
|
||||
|
||||
call RunTheTest(s:test)
|
||||
|
||||
" Repeat a flaky test. Give up when:
|
||||
" - $TEST_NO_RETRY is not empty
|
||||
" - it fails five times (with a different message)
|
||||
if len(v:errors) > 0
|
||||
\ && $TEST_NO_RETRY == ''
|
||||
\ && g:test_is_flaky
|
||||
for retryu in range( 5 )
|
||||
call add( s:messages, 'Found errors in ' . s:test . '. Retrying.' )
|
||||
call extend( s:messages, v:errors )
|
||||
|
||||
sleep 2
|
||||
|
||||
let v:errors = []
|
||||
call RunTheTest(s:test)
|
||||
|
||||
if len(v:errors) == 0
|
||||
" Test passed on rerun.
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
call AfterTheTest()
|
||||
endfor
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ function! Test_Step_With_Different_Tabpage()
|
|||
endfunction
|
||||
|
||||
function! Test_All_Buffers_Deleted_NoHidden()
|
||||
call ThisTestIsFlaky()
|
||||
|
||||
set nohidden
|
||||
lcd testdata/cpp/simple
|
||||
edit simple.cpp
|
||||
|
|
@ -79,6 +81,8 @@ function! Test_All_Buffers_Deleted_NoHidden()
|
|||
endfunction
|
||||
|
||||
function! Test_All_Buffers_Deleted_Hidden()
|
||||
call ThisTestIsFlaky()
|
||||
|
||||
set hidden
|
||||
lcd testdata/cpp/simple
|
||||
edit simple.cpp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue