Skip to content

Commit

Permalink
patch 9.0.0545: when a test is slow and CI times out there is no time…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
brammool committed Sep 22, 2022
1 parent fcba86c commit daaa3d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/testdir/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ SCRIPTSOURCE = ../../runtime
# Comment out this line to see the verbose output of tests.
#
# Catches SwapExists to avoid hanging at the ATTENTION prompt.
REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' | LC_ALL=C LANG=C LANGUAGE=C awk '/Executing Test_/{match($$0, "Executing Test_[^\\)]*\\)"); print substr($$0, RSTART, RLENGTH) "\r"; fflush()}'
REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' | LC_ALL=C LANG=C LANGUAGE=C awk '/Executing Test_/{match($$0, "(took .*; now )?Executing Test_[^\\)]*\\)"); print substr($$0, RSTART, RLENGTH) "\r"; fflush()}'

# Uncomment this line to use valgrind for memory leaks and extra warnings.
# The output goes into a file "valgrind.testN"
# Vim should be compiled with EXITFREE to avoid false warnings.
# This will make testing about 10 times as slow.
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=35 --log-file=valgrind.$*

# To execute one test, e.g. in gdb, use something like this:
# run -f -u unix.vim --gui-dialog-file guidialog -U NONE --noplugin --not-a-term -S runtest.vim test_name.vim

default: nongui

# The list of tests is common to all systems.
Expand Down
10 changes: 7 additions & 3 deletions src/testdir/runtest.vim
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,15 @@ function GetAllocId(name)
return lnum - top - 1
endfunc

let g:func_start = reltime()

func RunTheTest(test)
echoconsole '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
echoconsole prefix .. 'Executing ' .. a:test

" Avoid stopping at the "hit enter" prompt
set nomore
Expand Down Expand Up @@ -292,7 +296,7 @@ func RunTheTest(test)
let message = 'Executed ' . a:test
if has('reltime')
let message ..= repeat(' ', 50 - len(message))
let time = reltime(func_start)
let time = reltime(g:func_start)
if reltimefloat(time) > 0.1
let message = s:t_bold .. message
endif
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
545,
/**/
544,
/**/
Expand Down

0 comments on commit daaa3d9

Please sign in to comment.