Patch 9.0.0560
Problem:    Elapsed time since testing started is not visible.
Solution:   Show the elapsed time while running tests.
Files:      src/testdir/Make_all.mak, src/testdir/Makefile,
            src/testdir/Make_mvc.mak, src/testdir/Make_ming.mak,
            src/testdir/runtest.vim


*** ../vim-9.0.0559/src/testdir/Make_all.mak    2022-09-09 13:27:40.403539790 
+0100
--- src/testdir/Make_all.mak    2022-09-23 18:30:54.927670062 +0100
***************
*** 7,12 ****
--- 7,15 ----
  NO_PLUGINS = --noplugin --not-a-term
  NO_INITS = -U NONE $(NO_PLUGINS)
  
+ # File to delete when testing starts
+ CLEANUP_FILES = test.log messages starttime
+ 
  # Tests for tiny and small builds.
  SCRIPTS_TINY = \
        test20 \
*** ../vim-9.0.0559/src/testdir/Makefile        2022-09-22 15:12:53.932791017 
+0100
--- src/testdir/Makefile        2022-09-23 19:19:07.957353363 +0100
***************
*** 12,18 ****
  # 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, "(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"
--- 12,18 ----
  # 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, 
"([0-9][0-9]:[0-9][0-9] *)?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"
***************
*** 49,54 ****
--- 49,55 ----
                else echo No failures reported > test_result.log; \
                fi"
        $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages 
$(REDIR_TEST_TO_NULL)
+       @rm -f starttime
        @echo
        @echo 'Test results:'
        @cat test_result.log
***************
*** 63,69 ****
  # Execute an individual new style test, e.g.:
  #     make test_largefile
  $(NEW_TESTS):
!       rm -f [email protected] test.log messages
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile [email protected] 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @cat messages
        @if test -f test.log; then \
--- 64,70 ----
  # Execute an individual new style test, e.g.:
  #     make test_largefile
  $(NEW_TESTS):
!       rm -f [email protected] $(CLEANUP_FILES)
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile [email protected] 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @cat messages
        @if test -f test.log; then \
***************
*** 72,80 ****
  
  # Run only tests specific for Vim9 script
  test_vim9:
!       rm -f test_vim9_*.res test.log messages
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile $(TEST_VIM9_RES) 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @cat messages
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile report 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @if test -f test.log; then \
                exit 1; \
--- 73,82 ----
  
  # Run only tests specific for Vim9 script
  test_vim9:
!       rm -f test_vim9_*.res $(CLEANUP_FILES)
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile $(TEST_VIM9_RES) 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @cat messages
+       @rm -f starttime
        @MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile report 
VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
        @if test -f test.log; then \
                exit 1; \
***************
*** 88,94 ****
  # that may result from working on the tests, not only from running them.
  clean:
        -rm -rf *.out *.failed *.res *.rej *.orig XfakeHOME Xdir1 Xfind
!       -rm -f opt_test.vim test.log test_result.log messages
        -rm -rf $(RM_ON_RUN) $(RM_ON_START)
        -rm -f valgrind.*
        -rm -f asan.*
--- 90,96 ----
  # that may result from working on the tests, not only from running them.
  clean:
        -rm -rf *.out *.failed *.res *.rej *.orig XfakeHOME Xdir1 Xfind
!       -rm -f opt_test.vim test_result.log $(CLEANUP_FILES)
        -rm -rf $(RM_ON_RUN) $(RM_ON_START)
        -rm -f valgrind.*
        -rm -f asan.*
***************
*** 99,105 ****
        rm -f $(SCRIPTS_BENCH)
  
  nolog:
!       -rm -f test.log test_result.log messages
  
  
  # Tiny tests.  Works even without the +eval feature.
--- 101,107 ----
        rm -f $(SCRIPTS_BENCH)
  
  nolog:
!       -rm -f test_result.log $(CLEANUP_FILES)
  
  
  # Tiny tests.  Works even without the +eval feature.
*** ../vim-9.0.0559/src/testdir/Make_mvc.mak    2022-09-09 10:51:14.415772399 
+0100
--- src/testdir/Make_mvc.mak    2022-09-23 19:32:07.976142158 +0100
***************
*** 35,40 ****
--- 35,41 ----
        @if exist test.log ( copy /y test.log test_result.log > nul ) \
                else ( echo No failures reported > test_result.log )
        $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
+       -if exist starttime del starttime
        @echo.
        @echo Test results:
        @cmd /c type test_result.log
***************
*** 48,53 ****
--- 49,55 ----
        -if exist [email protected] del [email protected]
        -if exist test.log del test.log
        -if exist messages del messages
+       -if exist starttime del starttime
        @$(MAKE) -nologo -f Make_mvc.mak [email protected] VIMPROG=$(VIMPROG)
        @type messages
        @if exist test.log exit 1
***************
*** 71,76 ****
--- 73,79 ----
        -if exist test.log del test.log
        -if exist test_result.log del test_result.log
        -if exist messages del messages
+       -if exist starttime del starttime
        -if exist benchmark.out del benchmark.out
        -if exist opt_test.vim del opt_test.vim
        -if exist guidialog del guidialog
***************
*** 80,85 ****
--- 83,89 ----
        -if exist test.log del test.log
        -if exist test_result.log del test_result.log
        -if exist messages del messages
+       -if exist starttime del starttime
  
  
  # Tiny tests.  Works even without the +eval feature.
*** ../vim-9.0.0559/src/testdir/Make_ming.mak   2022-06-13 20:34:40.000000000 
+0100
--- src/testdir/Make_ming.mak   2022-09-23 19:35:42.291726979 +0100
***************
*** 47,52 ****
--- 47,53 ----
        @if exist test.log ( copy /y test.log test_result.log > nul ) \
                else ( echo No failures reported > test_result.log )
        $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
+       -if exist starttime del starttime
        @echo.
        @echo Test results:
        @cmd /c type test_result.log
***************
*** 60,65 ****
--- 61,67 ----
        -if exist [email protected] del [email protected]
        -if exist test.log del test.log
        -if exist messages del messages
+       -if exist starttime del starttime
        @$(MAKE) -f Make_ming.mak [email protected] VIMPROG=$(VIMPROG) --no-print-directory
        @type messages
        @if exist test.log exit 1
***************
*** 83,88 ****
--- 85,91 ----
        -@if exist test.log $(DEL) test.log
        -@if exist test_result.log del test_result.log
        -@if exist messages $(DEL) messages
+       -@if exist starttime $(DEL) starttime
        -@if exist benchmark.out del benchmark.out
        -@if exist opt_test.vim $(DEL) opt_test.vim
        -@if exist guidialog $(DEL) guidialog
***************
*** 92,97 ****
--- 95,101 ----
        -@if exist test.log $(DEL) test.log
        -@if exist test_result.log del test_result.log
        -@if exist messages $(DEL) messages
+       -@if exist starttime $(DEL) starttime
  
  
  # Tiny tests.  Works even without the +eval feature.
*** ../vim-9.0.0559/src/testdir/runtest.vim     2022-09-22 15:12:53.932791017 
+0100
--- src/testdir/runtest.vim     2022-09-23 19:27:48.872612728 +0100
***************
*** 74,80 ****
  endif
  
  if has('reltime')
!   let s:start_time = reltime()
  endif
  
  " Always use forward slashes.
--- 74,89 ----
  endif
  
  if has('reltime')
!   let s:run_start_time = reltime()
! 
!   if !filereadable('starttime')
!     " first test, store the overall test starting time
!     let s:test_start_time = localtime()
!     call writefile([string(s:test_start_time)], 'starttime')
!   else
!     " second or later test, read the overall test starting time
!     let s:test_start_time = readfile('starttime')[0]->str2nr()
!   endif
  endif
  
  " Always use forward slashes.
***************
*** 173,184 ****
    return lnum - top - 1
  endfunc
  
! let g:func_start = reltime()
  
  func RunTheTest(test)
    let prefix = ''
    if has('reltime')
!     let prefix = 'took ' .. reltimestr(reltime(g:func_start)) .. '; now '
      let g:func_start = reltime()
    endif
    echoconsole prefix .. 'Executing ' .. a:test
--- 182,195 ----
    return lnum - top - 1
  endfunc
  
! if has('reltime')
!   let g:func_start = reltime()
! endif
  
  func RunTheTest(test)
    let prefix = ''
    if has('reltime')
!     let prefix = strftime('%M:%S', localtime() - s:test_start_time) .. ' '
      let g:func_start = reltime()
    endif
    echoconsole prefix .. 'Executing ' .. a:test
***************
*** 377,383 ****
    endif
    if s:done > 0 && has('reltime')
      let message = s:t_bold .. message .. repeat(' ', 40 - len(message))
!     let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds'
      let message ..= s:t_normal
    endif
    echo message
--- 388,394 ----
    endif
    if s:done > 0 && has('reltime')
      let message = s:t_bold .. message .. repeat(' ', 40 - len(message))
!     let message ..= ' in ' .. reltimestr(reltime(s:run_start_time)) .. ' 
seconds'
      let message ..= s:t_normal
    endif
    echo message
*** ../vim-9.0.0559/src/version.c       2022-09-23 18:22:17.809281375 +0100
--- src/version.c       2022-09-23 19:39:34.555018287 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     560,
  /**/

-- 
Fingers not found - Pound head on keyboard to continue.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220923184415.1AF251C063B%40moolenaar.net.

Raspunde prin e-mail lui