mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0561: when a test gets stuck it just hangs forever
Problem: When a test gets stuck it just hangs forever.
Solution: Set a timeout of 30 seconds.
3bcd0ddc2d
Note: This doesn't cause test_timers.vim failures in Nvim because there
is a SetUp() function that calls timer_stopall().
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
63432c854f
commit
d82a6ca72a
@ -152,6 +152,17 @@ if has('reltime')
|
|||||||
let g:func_start = reltime()
|
let g:func_start = reltime()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Invoked when a test takes too much time.
|
||||||
|
func TestTimeout(id)
|
||||||
|
split test.log
|
||||||
|
call append(line('$'), '')
|
||||||
|
call append(line('$'), 'Test timed out: ' .. g:testfunc)
|
||||||
|
write
|
||||||
|
call add(v:errors, 'Test timed out: ' . g:testfunc)
|
||||||
|
|
||||||
|
cquit! 42
|
||||||
|
endfunc
|
||||||
|
|
||||||
func RunTheTest(test)
|
func RunTheTest(test)
|
||||||
let prefix = ''
|
let prefix = ''
|
||||||
if has('reltime')
|
if has('reltime')
|
||||||
@ -160,6 +171,12 @@ func RunTheTest(test)
|
|||||||
endif
|
endif
|
||||||
echo prefix .. 'Executing ' .. a:test
|
echo prefix .. 'Executing ' .. a:test
|
||||||
|
|
||||||
|
if has('timers')
|
||||||
|
" No test should take longer than 30 seconds. If it takes longer we
|
||||||
|
" assume we are stuck and need to break out.
|
||||||
|
let test_timeout_timer = timer_start(30000, 'TestTimeout')
|
||||||
|
endif
|
||||||
|
|
||||||
" Avoid stopping at the "hit enter" prompt
|
" Avoid stopping at the "hit enter" prompt
|
||||||
set nomore
|
set nomore
|
||||||
|
|
||||||
@ -225,6 +242,10 @@ func RunTheTest(test)
|
|||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has('timers')
|
||||||
|
call timer_stop(test_timeout_timer)
|
||||||
|
endif
|
||||||
|
|
||||||
" Clear any autocommands and put back the catch-all for SwapExists.
|
" Clear any autocommands and put back the catch-all for SwapExists.
|
||||||
au!
|
au!
|
||||||
au SwapExists * call HandleSwapExists()
|
au SwapExists * call HandleSwapExists()
|
||||||
|
Loading…
Reference in New Issue
Block a user