summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-03 13:10:44 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-03 13:10:44 +0100
commitb5760a1ce5b700fc32b8bd11948ee189a847c59e (patch)
treef22134d300f97d1456ca0ed2b6cba5566e177f4e
parentf1d2501ebe33e148886c2914acd33140e20ee222 (diff)
patch 7.4.1477v7.4.1477
Problem: Test_reltime is flaky, it depends on timing. Solution: When it fails run it a second time.
-rw-r--r--src/testdir/runtest.vim41
-rw-r--r--src/version.c2
2 files changed, 29 insertions, 14 deletions
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 469a4d3855..0cf50006db 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -72,6 +72,24 @@ function GetAllocId(name)
return lnum - top - 1
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
" navigates away. g:testname can be used by the tests.
@@ -92,6 +110,9 @@ else
endtry
endif
+" Names of flaky tests.
+let s:flaky = ['Test_reltime()']
+
" Locate Test_ functions and execute them.
set nomore
redir @q
@@ -106,18 +127,13 @@ endif
" Execute the tests in alphabetical order.
for s:test in sort(s:tests)
- echo 'Executing ' . s:test
- if exists("*SetUp")
- call SetUp()
- endif
+ call RunTheTest(s:test)
- call add(s:messages, 'Executing ' . s:test)
- let s:done += 1
- try
- exe 'call ' . s:test
- catch
- call add(v:errors, 'Caught exception in ' . s:test . ': ' . v:exception . ' @ ' . v:throwpoint)
- endtry
+ if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
+ call add(s:messages, 'Flaky test failed, running it again')
+ let v:errors = []
+ call RunTheTest(s:test)
+ endif
if len(v:errors) > 0
let s:fail += 1
@@ -126,9 +142,6 @@ for s:test in sort(s:tests)
let v:errors = []
endif
- if exists("*TearDown")
- call TearDown()
- endif
endfor
if s:fail == 0
diff --git a/src/version.c b/src/version.c
index c11af3f669..a8e3f39cb2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1477,
+/**/
1476,
/**/
1475,