diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 10:34:23 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-19 11:29:35 +0800 |
commit | 63432c854fa06a1587e1bc6afc3e086f9e8c137a (patch) | |
tree | c45aa5f5ada663966aeddb20821b5615ccffd3ef | |
parent | 7592540029d32328cce6d8e6a9b134c051413cef (diff) | |
download | rneovim-63432c854fa06a1587e1bc6afc3e086f9e8c137a.tar.gz rneovim-63432c854fa06a1587e1bc6afc3e086f9e8c137a.tar.bz2 rneovim-63432c854fa06a1587e1bc6afc3e086f9e8c137a.zip |
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.
https://github.com/vim/vim/commit/b9093d50098ccff3848c2a404b9d0324a074c7b7
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | test/old/testdir/Makefile | 11 | ||||
-rw-r--r-- | test/old/testdir/runtest.vim | 19 |
3 files changed, 23 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore index 5ada7d171a..d04b91dbb7 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ compile_commands.json /test/old/testdir/test*.res /test/old/testdir/test*.log /test/old/testdir/messages +/test/old/testdir/starttime /test/old/testdir/viminfo /test/old/testdir/test.ok /test/old/testdir/*.failed diff --git a/test/old/testdir/Makefile b/test/old/testdir/Makefile index 9511b311e6..b5ca6a17b0 100644 --- a/test/old/testdir/Makefile +++ b/test/old/testdir/Makefile @@ -70,6 +70,7 @@ report: then echo TEST FAILURE; exit 1; \ else echo ALL DONE; \ fi" + @rm -f starttime test1.out: $(NVIM_PRG) @@ -86,10 +87,13 @@ fixff: -$(NVIM_PRG) $(NO_INITS) -u unix.vim "+argdo set ff=dos|upd" +q \ dotest.in +# File to delete when testing starts +CLEANUP_FILES = test.log messages starttime + # 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 @cat messages @if test -f test.log; then \ @@ -108,9 +112,8 @@ CLEAN_FILES := *.out \ *.rej \ *.orig \ *.tlog \ - test.log \ test_result.log \ - messages \ + $(CLEANUP_FILES) \ $(RM_ON_RUN) \ $(RM_ON_START) \ valgrind.* \ @@ -132,7 +135,7 @@ test1.out: .gdbinit test1.in nolog: @echo "[OLDTEST-PREP] Removing test.log and messages" - @rm -f test.log messages + @rm -f test_result.log $(CLEANUP_FILES) # New style of tests uses Vim script with assert calls. These are easier diff --git a/test/old/testdir/runtest.vim b/test/old/testdir/runtest.vim index 5ece1bcd2a..c47272dcdc 100644 --- a/test/old/testdir/runtest.vim +++ b/test/old/testdir/runtest.vim @@ -61,7 +61,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. @@ -139,12 +148,14 @@ func 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 echo prefix .. 'Executing ' .. a:test @@ -328,7 +339,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 |