mirror of
https://github.com/neovim/neovim.git
synced 2025-10-18 07:41:51 +00:00
vim-patch:8.1.1476: no statistics displayed after running tests
Problem: No statistics displayed after running tests.
Solution: Summarize the test results. (Christian Brabandt, closes vim/vim#4391)
Also make it possible to report a skipped file.
9c0cec65f8
Removes our custom no-inits from `$(RUN_VIMTEST)`, since we have
`$(NO_INITS)` now also.
This commit is contained in:
@@ -86,14 +86,13 @@ nongui: nolog $(FIXFF) $(SCRIPTS) newtests report
|
|||||||
@echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit
|
@echo 'set $$_exitcode = -1\nrun\nif $$_exitcode != -1\n quit\nend' > .gdbinit
|
||||||
|
|
||||||
report:
|
report:
|
||||||
|
$(RUN_VIMTEST) $(NO_INITS) -S summarize.vim messages
|
||||||
@echo
|
@echo
|
||||||
@echo 'Test results:'
|
@echo 'Test results:'
|
||||||
@/bin/sh -c "if test -f test.log; then \
|
@cat test_result.log
|
||||||
cat test.log; \
|
@/bin/sh -c "if test -f test.log; \
|
||||||
echo TEST FAILURE; \
|
then echo TEST FAILURE; exit 1; \
|
||||||
exit 1; \
|
else echo ALL DONE; \
|
||||||
else \
|
|
||||||
echo ALL DONE; \
|
|
||||||
fi"
|
fi"
|
||||||
|
|
||||||
test1.out: $(NVIM_PRG)
|
test1.out: $(NVIM_PRG)
|
||||||
@@ -124,6 +123,7 @@ CLEAN_FILES := *.out \
|
|||||||
*.orig \
|
*.orig \
|
||||||
*.tlog \
|
*.tlog \
|
||||||
test.log \
|
test.log \
|
||||||
|
test_result.log \
|
||||||
messages \
|
messages \
|
||||||
$(RM_ON_RUN) \
|
$(RM_ON_RUN) \
|
||||||
$(RM_ON_START) \
|
$(RM_ON_START) \
|
||||||
@@ -163,7 +163,7 @@ nolog:
|
|||||||
# New style of tests uses Vim script with assert calls. These are easier
|
# New style of tests uses Vim script with assert calls. These are easier
|
||||||
# to write and a lot easier to read and debug.
|
# to write and a lot easier to read and debug.
|
||||||
# Limitation: Only works with the +eval feature.
|
# Limitation: Only works with the +eval feature.
|
||||||
RUN_VIMTEST = $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin
|
RUN_VIMTEST = $(TOOL) $(NVIM_PRG) -u unix.vim
|
||||||
|
|
||||||
newtests: newtestssilent
|
newtests: newtestssilent
|
||||||
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \
|
@/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then \
|
||||||
@@ -176,4 +176,4 @@ newtestssilent: $(NEW_TESTS)
|
|||||||
@echo "[OLDTEST] Running" $*
|
@echo "[OLDTEST] Running" $*
|
||||||
@rm -rf $*.failed test.ok $(RM_ON_RUN)
|
@rm -rf $*.failed test.ok $(RM_ON_RUN)
|
||||||
@mkdir -p $(TMPDIR)
|
@mkdir -p $(TMPDIR)
|
||||||
@/bin/sh runnvim.sh $(ROOT) $(NVIM_PRG) $* $(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim
|
@/bin/sh runnvim.sh $(ROOT) $(NVIM_PRG) $* $(RUN_VIMTEST) $(NO_INITS) -u NONE -S runtest.vim $*.vim
|
||||||
|
@@ -268,6 +268,9 @@ if expand('%') =~ 'test_vimscript.vim'
|
|||||||
else
|
else
|
||||||
try
|
try
|
||||||
source %
|
source %
|
||||||
|
catch /^\cskipped/
|
||||||
|
call add(s:messages, ' Skipped')
|
||||||
|
call add(s:skipped, 'SKIPPED ' . expand('%') . ': ' . substitute(v:exception, '^\S*\s\+', '', ''))
|
||||||
catch
|
catch
|
||||||
let s:fail += 1
|
let s:fail += 1
|
||||||
call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
|
call add(s:errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
|
||||||
|
60
src/nvim/testdir/summarize.vim
Normal file
60
src/nvim/testdir/summarize.vim
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
if 1
|
||||||
|
" This is executed with the eval feature
|
||||||
|
set nocp
|
||||||
|
func Count(match, type)
|
||||||
|
if a:type ==# 'executed'
|
||||||
|
let g:executed += (a:match+0)
|
||||||
|
elseif a:type ==# 'failed'
|
||||||
|
let g:failed = a:match+0
|
||||||
|
elseif a:type ==# 'skipped'
|
||||||
|
let g:skipped += 1
|
||||||
|
call extend(g:skipped_output, ["\t".a:match])
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
let g:executed = 0
|
||||||
|
let g:skipped = 0
|
||||||
|
let g:failed = 0
|
||||||
|
let g:skipped_output = []
|
||||||
|
let g:failed_output = []
|
||||||
|
let output = [""]
|
||||||
|
|
||||||
|
try
|
||||||
|
" This uses the :s command to just fetch and process the output of the
|
||||||
|
" tests, it doesn't acutally replay anything
|
||||||
|
%s/^Executed\s\+\zs\d\+\ze\s\+tests/\=Count(submatch(0),'executed')/egn
|
||||||
|
%s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
|
||||||
|
%s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
|
||||||
|
|
||||||
|
call extend(output, ["Skipped:"])
|
||||||
|
call extend(output, skipped_output)
|
||||||
|
|
||||||
|
call extend(output, [
|
||||||
|
\ "",
|
||||||
|
\ "-------------------------------",
|
||||||
|
\ printf("Executed: %5d Tests", g:executed),
|
||||||
|
\ printf(" Skipped: %5d Tests", g:skipped),
|
||||||
|
\ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
|
||||||
|
\ "",
|
||||||
|
\ ])
|
||||||
|
if filereadable('test.log')
|
||||||
|
" outputs and indents the failed test result
|
||||||
|
call extend(output, ["", "Failures: "])
|
||||||
|
let failed_output = filter(readfile('test.log'), { v,k -> !empty(k)})
|
||||||
|
call extend(output, map(failed_output, { v,k -> "\t".k}))
|
||||||
|
" Add a final newline
|
||||||
|
call extend(output, [""])
|
||||||
|
endif
|
||||||
|
|
||||||
|
catch " Catch-all
|
||||||
|
finally
|
||||||
|
call writefile(output, 'test_result.log') " overwrites an existing file
|
||||||
|
q!
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
|
||||||
|
" This is executed without the eval feature
|
||||||
|
%d
|
||||||
|
r test.log
|
||||||
|
w test_result.log
|
||||||
|
q!
|
@@ -3,7 +3,7 @@
|
|||||||
" functional tests that check the shaping works with real text.
|
" functional tests that check the shaping works with real text.
|
||||||
|
|
||||||
if !has('arabic')
|
if !has('arabic')
|
||||||
finish
|
throw 'Skipped: arabic feature missing'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
source view_util.vim
|
source view_util.vim
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
" Test 'autochdir' behavior
|
" Test 'autochdir' behavior
|
||||||
|
|
||||||
if !exists("+autochdir")
|
if !exists("+autochdir")
|
||||||
finish
|
throw 'Skipped: autochdir feature missing'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
func Test_set_filename()
|
func Test_set_filename()
|
||||||
|
Reference in New Issue
Block a user