1
0
forked from aniani/vim

patch 9.0.0560: elapsed time since testing started is not visible

Problem:    Elapsed time since testing started is not visible.
Solution:   Show the elapsed time while running tests.
This commit is contained in:
Bram Moolenaar
2022-09-23 19:42:31 +01:00
parent 4ecf16bbf9
commit b9093d5009
6 changed files with 35 additions and 9 deletions

View File

@@ -7,6 +7,9 @@
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 \

View File

@@ -47,6 +47,7 @@ report:
@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,6 +61,7 @@ $(NEW_TESTS):
-if exist $@.res del $@.res
-if exist test.log del test.log
-if exist messages del messages
-if exist starttime del starttime
@$(MAKE) -f Make_ming.mak $@.res VIMPROG=$(VIMPROG) --no-print-directory
@type messages
@if exist test.log exit 1
@@ -83,6 +85,7 @@ clean:
-@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,6 +95,7 @@ nolog:
-@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.

View File

@@ -35,6 +35,7 @@ report:
@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,6 +49,7 @@ $(NEW_TESTS):
-if exist $@.res del $@.res
-if exist test.log del test.log
-if exist messages del messages
-if exist starttime del starttime
@$(MAKE) -nologo -f Make_mvc.mak $@.res VIMPROG=$(VIMPROG)
@type messages
@if exist test.log exit 1
@@ -71,6 +73,7 @@ clean:
-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,6 +83,7 @@ nolog:
-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.

View File

@@ -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, "(took .*; now )?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, "([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,6 +49,7 @@ report:
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,7 +64,7 @@ $(SCRIPTS_TINY_OUT) $(NEW_TESTS_RES): $(VIMPROG)
# Execute an individual new style test, e.g.:
# make test_largefile
$(NEW_TESTS):
rm -f $@.res test.log messages
rm -f $@.res $(CLEANUP_FILES)
@MAKEFLAGS=--no-print-directory $(MAKE) -f Makefile $@.res VIMPROG=$(VIMPROG) XXDPROG=$(XXDPROG) SCRIPTSOURCE=$(SCRIPTSOURCE)
@cat messages
@if test -f test.log; then \
@@ -72,9 +73,10 @@ $(NEW_TESTS):
# Run only tests specific for Vim9 script
test_vim9:
rm -f test_vim9_*.res test.log messages
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,7 +90,7 @@ RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u un
# 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 -f opt_test.vim test_result.log $(CLEANUP_FILES)
-rm -rf $(RM_ON_RUN) $(RM_ON_START)
-rm -f valgrind.*
-rm -f asan.*
@@ -99,7 +101,7 @@ benchmarkclean:
rm -f $(SCRIPTS_BENCH)
nolog:
-rm -f test.log test_result.log messages
-rm -f test_result.log $(CLEANUP_FILES)
# Tiny tests. Works even without the +eval feature.

View File

@@ -74,7 +74,16 @@ if &lines < 24 || &columns < 80
endif
if has('reltime')
let s:start_time = 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,12 +182,14 @@ function GetAllocId(name)
return lnum - top - 1
endfunc
let g:func_start = reltime()
if has('reltime')
let g:func_start = reltime()
endif
func RunTheTest(test)
let prefix = ''
if has('reltime')
let prefix = 'took ' .. reltimestr(reltime(g:func_start)) .. '; now '
let prefix = strftime('%M:%S', localtime() - s:test_start_time) .. ' '
let g:func_start = reltime()
endif
echoconsole prefix .. 'Executing ' .. a:test
@@ -377,7 +388,7 @@ func FinishTesting()
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 ..= ' in ' .. reltimestr(reltime(s:run_start_time)) .. ' seconds'
let message ..= s:t_normal
endif
echo message

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
560,
/**/
559,
/**/