Skip to content

Commit 7c2beb4

Browse files
committed
patch 9.0.1675: test may run into timeout when using valgrind
Problem: Test may run into timeout when using valgrind. Solution: Use a longer timeout when using valgrind.
1 parent 416bd91 commit 7c2beb4

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/testdir/runtest.vim

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ set shellslash
9292
" Common with all tests on all systems.
9393
source 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.
97100
set nocp viminfo+=nviminfo
@@ -219,12 +222,18 @@ unlet name
219222
func 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
227235
endfunc
236+
let g:timeout_start = 0
228237

229238
func 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

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1675,
698700
/**/
699701
1674,
700702
/**/

0 commit comments

Comments
 (0)