0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1477

Problem:    Test_reltime is flaky, it depends on timing.
Solution:   When it fails run it a second time.
This commit is contained in:
Bram Moolenaar 2016-03-03 13:10:44 +01:00
parent f1d2501ebe
commit b5760a1ce5
2 changed files with 29 additions and 14 deletions

View File

@ -72,6 +72,24 @@ function GetAllocId(name)
return lnum - top - 1 return lnum - top - 1
endfunc endfunc
function RunTheTest(test)
echo 'Executing ' . a:test
if exists("*SetUp")
call SetUp()
endif
call add(s:messages, 'Executing ' . a:test)
let s:done += 1
try
exe 'call ' . a:test
catch
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
endtry
if exists("*TearDown")
call TearDown()
endif
endfunc
" Source the test script. First grab the file name, in case the script " Source the test script. First grab the file name, in case the script
" navigates away. g:testname can be used by the tests. " navigates away. g:testname can be used by the tests.
@ -92,6 +110,9 @@ else
endtry endtry
endif endif
" Names of flaky tests.
let s:flaky = ['Test_reltime()']
" Locate Test_ functions and execute them. " Locate Test_ functions and execute them.
set nomore set nomore
redir @q redir @q
@ -106,18 +127,13 @@ endif
" Execute the tests in alphabetical order. " Execute the tests in alphabetical order.
for s:test in sort(s:tests) for s:test in sort(s:tests)
echo 'Executing ' . s:test call RunTheTest(s:test)
if exists("*SetUp")
call SetUp()
endif
call add(s:messages, 'Executing ' . s:test) if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
let s:done += 1 call add(s:messages, 'Flaky test failed, running it again')
try let v:errors = []
exe 'call ' . s:test call RunTheTest(s:test)
catch endif
call add(v:errors, 'Caught exception in ' . s:test . ': ' . v:exception . ' @ ' . v:throwpoint)
endtry
if len(v:errors) > 0 if len(v:errors) > 0
let s:fail += 1 let s:fail += 1
@ -126,9 +142,6 @@ for s:test in sort(s:tests)
let v:errors = [] let v:errors = []
endif endif
if exists("*TearDown")
call TearDown()
endif
endfor endfor
if s:fail == 0 if s:fail == 0

View File

@ -743,6 +743,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 */
/**/
1477,
/**/ /**/
1476, 1476,
/**/ /**/