Mercurial > vim
changeset 30451:c9d72c379cec v9.0.0561
patch 9.0.0561: when a test gets stuck it just hangs forever
Commit: https://github.com/vim/vim/commit/3bcd0ddc2deb34794c735c6ea0b8f964b510c6db
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 23 20:25:55 2022 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 23 Sep 2022 21:30:04 +0200 |
parents | 800b2f95f159 |
children | 484e295a50f5 |
files | src/testdir/runtest.vim src/version.c |
diffstat | 2 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -186,6 +186,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') @@ -194,6 +205,12 @@ func RunTheTest(test) endif echoconsole 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 @@ -259,6 +276,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()