To: vim_dev@googlegroups.com Subject: Patch 7.4.1477 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1477 Problem: Test_reltime is flaky, it depends on timing. Solution: When it fails run it a second time. Files: src/testdir/runtest.vim *** ../vim-7.4.1476/src/testdir/runtest.vim 2016-02-20 14:41:36.503890373 +0100 --- src/testdir/runtest.vim 2016-03-03 13:06:47.942865806 +0100 *************** *** 72,77 **** --- 72,95 ---- 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,97 **** --- 110,118 ---- endtry endif + " Names of flaky tests. + let s:flaky = ['Test_reltime()'] + " Locate Test_ functions and execute them. set nomore redir @q *************** *** 106,123 **** " Execute the tests in alphabetical order. for s:test in sort(s:tests) ! echo 'Executing ' . s:test ! if exists("*SetUp") ! call SetUp() ! endif ! 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 let s:fail += 1 --- 127,139 ---- " Execute the tests in alphabetical order. for s:test in sort(s:tests) ! call RunTheTest(s:test) ! 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,134 **** let v:errors = [] endif - if exists("*TearDown") - call TearDown() - endif endfor if s:fail == 0 --- 142,147 ---- *** ../vim-7.4.1476/src/version.c 2016-03-03 12:22:48.570553923 +0100 --- src/version.c 2016-03-03 13:07:28.006444969 +0100 *************** *** 745,746 **** --- 745,748 ---- { /* Add new patch number below this line */ + /**/ + 1477, /**/ -- ARTHUR: What are you going to do. bleed on me? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///