diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 10:53:12 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 11:29:35 +0800 |
commit | d82a6ca72aca57d89cfb8954abf2ae3980f85c04 (patch) | |
tree | b78b9190f6b5c64de3864f6a5c25b6353c0d0ea3 | |
parent | 63432c854fa06a1587e1bc6afc3e086f9e8c137a (diff) | |
download | rneovim-d82a6ca72aca57d89cfb8954abf2ae3980f85c04.tar.gz rneovim-d82a6ca72aca57d89cfb8954abf2ae3980f85c04.tar.bz2 rneovim-d82a6ca72aca57d89cfb8954abf2ae3980f85c04.zip |
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.
https://github.com/vim/vim/commit/3bcd0ddc2deb34794c735c6ea0b8f964b510c6db
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>
-rw-r--r-- | test/old/testdir/runtest.vim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index c47272dcdc..114a3229d4 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -152,6 +152,17 @@ if has('reltime') let g:func_start = reltime() 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) let prefix = '' if has('reltime') @@ -160,6 +171,12 @@ func RunTheTest(test) endif 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 set nomore @@ -225,6 +242,10 @@ func RunTheTest(test) endtry endif + if has('timers') + call timer_stop(test_timeout_timer) + endif + " Clear any autocommands and put back the catch-all for SwapExists. au! au SwapExists * call HandleSwapExists() |