From 7592540029d32328cce6d8e6a9b134c051413cef Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 19 Apr 2023 10:26:54 +0800 Subject: [PATCH] vim-patch:9.0.0545: when a test is slow and CI times out there is no time info Problem: When a test is slow and CI times out there is no time info. Solution: Add the elapsed time to the "Executing" message. https://github.com/vim/vim/commit/daaa3d9965d74faf1f75aea218822bfb7ba687a7 Co-authored-by: Bram Moolenaar --- test/old/testdir/runtest.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 9d5e3333cb..5ece1bcd2a 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -139,11 +139,15 @@ func GetAllocId(name) return lnum - top - 1 endfunc +let g:func_start = reltime() + func RunTheTest(test) - echo 'Executing ' . a:test + let prefix = '' if has('reltime') - let func_start = reltime() + let prefix = 'took ' .. reltimestr(reltime(g:func_start)) .. '; now ' + let g:func_start = reltime() endif + echo prefix .. 'Executing ' .. a:test " Avoid stopping at the "hit enter" prompt set nomore @@ -247,12 +251,12 @@ func RunTheTest(test) let message = 'Executed ' . a:test if has('reltime') let message ..= repeat(' ', 50 - len(message)) - let time = reltime(func_start) - if has('float') && reltimefloat(time) > 0.1 + let time = reltime(g:func_start) + if reltimefloat(time) > 0.1 let message = s:t_bold .. message endif let message ..= ' in ' .. reltimestr(time) .. ' seconds' - if has('float') && reltimefloat(time) > 0.1 + if reltimefloat(time) > 0.1 let message ..= s:t_normal endif endif