changeset 30419:f652823ce8bb v9.0.0545

patch 9.0.0545: when a test is slow and CI times out there is no time info Commit: https://github.com/vim/vim/commit/daaa3d9965d74faf1f75aea218822bfb7ba687a7 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 22 15:13:00 2022 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Sep 2022 16:15:03 +0200
parents d8065e2a62d7
children 920fc6b9b395
files src/testdir/Makefile src/testdir/runtest.vim src/version.c
diffstat 3 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -12,7 +12,7 @@ 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"
@@ -20,6 +20,9 @@ REDIR_TEST_TO_NULL = --cmd 'au SwapExist
 #   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.
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -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
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -700,6 +700,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    545,
+/**/
     544,
 /**/
     543,