mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
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.
b9093d5009
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
7592540029
commit
63432c854f
1
.gitignore
vendored
1
.gitignore
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user