@@ -92,6 +92,9 @@ set shellslash
9292" Common with all tests on all systems.
9393source setup.vim
9494
95+ " Needed for RunningWithValgrind().
96+ source shared.vim
97+
9598" For consistency run all tests with 'nocompatible' set.
9699" This also enables use of line continuation.
97100set nocp viminfo += nviminfo
@@ -219,12 +222,18 @@ unlet name
219222func TestTimeout (id)
220223 split test.log
221224 call append (line (' $' ), ' ' )
222- call append (line (' $' ), ' Test timed out: ' .. g: testfunc )
225+
226+ let text = ' Test timed out: ' .. g: testfunc
227+ if g: timeout_start > 0
228+ let text ..= strftime (' after %s seconds' , localtime () - g: timeout_start )
229+ endif
230+ call append (line (' $' ), text)
223231 write
224- call add (v: errors , ' Test timed out: ' . g: testfunc )
232+ call add (v: errors , text )
225233
226234 cquit ! 42
227235endfunc
236+ let g: timeout_start = 0
228237
229238func RunTheTest (test)
230239 let prefix = ' '
@@ -237,7 +246,9 @@ func RunTheTest(test)
237246 if has (' timers' )
238247 " No test should take longer than 30 seconds. If it takes longer we
239248 " assume we are stuck and need to break out.
240- let test_timeout_timer = timer_start (30000 , ' TestTimeout' )
249+ let test_timeout_timer =
250+ \ timer_start (RunningWithValgrind () ? 50000 : 30000 , ' TestTimeout' )
251+ let g: timeout_start = localtime ()
241252 endif
242253
243254 " Avoid stopping at the "hit enter" prompt
@@ -307,6 +318,7 @@ func RunTheTest(test)
307318
308319 if has (' timers' )
309320 call timer_stop (test_timeout_timer)
321+ let g: timeout_start = 0
310322 endif
311323
312324 " Clear any autocommands and put back the catch-all for SwapExists.
@@ -371,7 +383,7 @@ func RunTheTest(test)
371383
372384 " close any split windows
373385 while winnr (' $' ) > 1
374- bwipe!
386+ noswapfile bwipe!
375387 endwhile
376388
377389 " May be editing some buffer, wipe it out. Then we may end up in another
0 commit comments