mirror of
https://github.com/vim/vim
synced 2025-07-16 09:12:00 +00:00
runtime(syntax-tests): Do not ignore failed screendumps
The process of preparing and submitting syntax tests is fraught with challenges that can turn away many aspiring contributors from ever attempting it. (Out of 69 languages introduced since v9.0.1627, there are only syntax tests for Tera.) After v9.1.1176~1, one visual clue for admitting syntax test failures previously available with e.g. "git status" is gone after all files under "failed/" have been made ignored for Git and Mercurial. There isn't a single way to go about it: some people may move files from "failed/" to "dumps/" after each iteration; some people may only move "good" iteration files; when a test file is refactored to a great extent, some people may prefer deleting all test-related files under "dumps/" before moving files from "failed/". The usability of reporting, at any time, that there are some _untracked_ files under "failed/" cannot be overstated. Without it, the chances are greater for pushing mismatched changesets. And when tests fail then everyone but the author will be kept in the dark about the cause: were some updated screendumps not committed _or_ was a wrong version of the syntax plugin committed? Another file, "testdir/Xfilter" (v9.1.0763), that will be created to establish communication from Make to Vim about what subset of syntax tests is requested for running, should also be not ignored but rather deleted once its contents are read. Unless it is explicitly deleted _after test failure_, the file may contain new *and* old test names when another testing attempt is under way. And by virtue of it being ignored, the reason for also running not requested tests will be as ever puzzling. Both Git and Mercurial support per-user configuration; such wide-reaching settings hardly belong to clonable defaults. Also, match literal dots in testname filters. Also, discover and report _some_ disused screendump files tracked under "dumps/". References: - https://git-scm.com/docs/gitignore - https://www.mercurial-scm.org/help/topics/config#ui closes: #16917 Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
4e7b4308fb
commit
b5459ee104
2
.gitignore
vendored
2
.gitignore
vendored
@ -96,9 +96,7 @@ src/json_test
|
|||||||
src/message_test
|
src/message_test
|
||||||
src/kword_test
|
src/kword_test
|
||||||
|
|
||||||
runtime/syntax/testdir/Xfilter
|
|
||||||
runtime/syntax/testdir/done/
|
runtime/syntax/testdir/done/
|
||||||
runtime/syntax/testdir/failed/
|
|
||||||
runtime/syntax/testdir/messages
|
runtime/syntax/testdir/messages
|
||||||
runtime/syntax/testdir/testdeps.mk
|
runtime/syntax/testdir/testdeps.mk
|
||||||
runtime/syntax/testdir/vimcmd
|
runtime/syntax/testdir/vimcmd
|
||||||
|
@ -98,9 +98,7 @@ src/json_test
|
|||||||
src/message_test
|
src/message_test
|
||||||
src/kword_test
|
src/kword_test
|
||||||
|
|
||||||
runtime/syntax/testdir/Xfilter
|
|
||||||
runtime/syntax/testdir/done/
|
runtime/syntax/testdir/done/
|
||||||
runtime/syntax/testdir/failed/
|
|
||||||
runtime/syntax/testdir/messages
|
runtime/syntax/testdir/messages
|
||||||
runtime/syntax/testdir/testdeps.mk
|
runtime/syntax/testdir/testdeps.mk
|
||||||
runtime/syntax/testdir/vimcmd
|
runtime/syntax/testdir/vimcmd
|
||||||
|
@ -43,7 +43,6 @@ test:
|
|||||||
@#mkdir -p testdir/failed
|
@#mkdir -p testdir/failed
|
||||||
@#touch "$(VIM_SYNTAX_TEST_LOG)"
|
@#touch "$(VIM_SYNTAX_TEST_LOG)"
|
||||||
VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim > /dev/null
|
VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim > /dev/null
|
||||||
@rm -f testdir/Xfilter
|
|
||||||
@# FIXME: Temporarily show the whole file to find out what goes wrong
|
@# FIXME: Temporarily show the whole file to find out what goes wrong
|
||||||
@#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi
|
@#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi
|
||||||
@if [ -f testdir/messages ]; then cat testdir/messages; fi
|
@if [ -f testdir/messages ]; then cat testdir/messages; fi
|
||||||
|
@ -389,18 +389,21 @@ func RunTest()
|
|||||||
\ : {}
|
\ : {}
|
||||||
lockvar DUMP_OPTS MAX_FAILED_COUNT XTESTSCRIPT
|
lockvar DUMP_OPTS MAX_FAILED_COUNT XTESTSCRIPT
|
||||||
let ok_count = 0
|
let ok_count = 0
|
||||||
|
let disused_pages = []
|
||||||
let failed_tests = []
|
let failed_tests = []
|
||||||
let skipped_count = 0
|
let skipped_count = 0
|
||||||
let last_test_status = 'invalid'
|
let last_test_status = 'invalid'
|
||||||
|
let filter = ''
|
||||||
" Create a map of setup configuration filenames with their basenames as keys.
|
" Create a map of setup configuration filenames with their basenames as keys.
|
||||||
let setup = glob('input/setup/*.vim', 1, 1)
|
let setup = glob('input/setup/*.vim', 1, 1)
|
||||||
\ ->reduce({d, f -> extend(d, {fnamemodify(f, ':t:r'): f})}, {})
|
\ ->reduce({d, f -> extend(d, {fnamemodify(f, ':t:r'): f})}, {})
|
||||||
" Turn a subset of filenames etc. requested for testing into a pattern.
|
" Turn a subset of filenames etc. requested for testing into a pattern.
|
||||||
let filter = filereadable('../testdir/Xfilter')
|
if filereadable('../testdir/Xfilter')
|
||||||
\ ? readfile('../testdir/Xfilter')
|
let filter = readfile('../testdir/Xfilter')
|
||||||
\ ->map({_, v -> '^' .. substitute(v, '_$', '', '')})
|
\ ->map({_, v -> '^' .. escape(substitute(v, '_$', '', ''), '.')})
|
||||||
\ ->join('\|')
|
\ ->join('\|')
|
||||||
\ : ''
|
call delete('../testdir/Xfilter')
|
||||||
|
endif
|
||||||
|
|
||||||
" Treat "^self-testing" as a string NOT as a regexp.
|
" Treat "^self-testing" as a string NOT as a regexp.
|
||||||
if filter ==# '^self-testing'
|
if filter ==# '^self-testing'
|
||||||
@ -430,8 +433,8 @@ func RunTest()
|
|||||||
let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
|
let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
|
||||||
let failed_root = 'failed/' .. root
|
let failed_root = 'failed/' .. root
|
||||||
|
|
||||||
for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1)
|
for pagename in glob(failed_root .. '_\d*\.dump', 1, 1)
|
||||||
call delete(dumpname)
|
call delete(pagename)
|
||||||
endfor
|
endfor
|
||||||
call delete('done/' .. root)
|
call delete('done/' .. root)
|
||||||
call writefile(XTESTSCRIPT, 'Xtestscript')
|
call writefile(XTESTSCRIPT, 'Xtestscript')
|
||||||
@ -477,11 +480,11 @@ func RunTest()
|
|||||||
call ch_log('First screendump for ' .. in_name_and_out_name)
|
call ch_log('First screendump for ' .. in_name_and_out_name)
|
||||||
" Make a screendump at the start of the file: failed/root_00.dump
|
" Make a screendump at the start of the file: failed/root_00.dump
|
||||||
let fail = VerifyScreenDump(buf, root_00, DUMP_OPTS)
|
let fail = VerifyScreenDump(buf, root_00, DUMP_OPTS)
|
||||||
|
let nr = 0
|
||||||
|
|
||||||
" Accommodate the next code block to "buf"'s contingency for self
|
" Accommodate the next code block to "buf"'s contingency for self
|
||||||
" wipe-out.
|
" wipe-out.
|
||||||
try
|
try
|
||||||
let nr = 0
|
|
||||||
let keys_a = ":call ScrollToSecondPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
|
let keys_a = ":call ScrollToSecondPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
|
||||||
let keys_b = ":call ScrollToNextPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
|
let keys_b = ":call ScrollToNextPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
|
||||||
while s:CannotSeeLastLine(ruler)
|
while s:CannotSeeLastLine(ruler)
|
||||||
@ -503,6 +506,15 @@ func RunTest()
|
|||||||
call delete('Xtestscript')
|
call delete('Xtestscript')
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
let nr += 1
|
||||||
|
let pagename = printf('dumps/%s_%02d.dump', root, nr)
|
||||||
|
|
||||||
|
while filereadable(pagename)
|
||||||
|
call add(disused_pages, pagename)
|
||||||
|
let nr += 1
|
||||||
|
let pagename = printf('dumps/%s_%02d.dump', root, nr)
|
||||||
|
endwhile
|
||||||
|
|
||||||
" redraw here to avoid the following messages to get mixed up with screen
|
" redraw here to avoid the following messages to get mixed up with screen
|
||||||
" output.
|
" output.
|
||||||
redraw
|
redraw
|
||||||
@ -573,6 +585,10 @@ func RunTest()
|
|||||||
call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests))
|
call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests))
|
||||||
call Message('skipped: ' .. skipped_count)
|
call Message('skipped: ' .. skipped_count)
|
||||||
|
|
||||||
|
for pagename in disused_pages
|
||||||
|
call Message(printf('No input page found for "%s"', pagename))
|
||||||
|
endfor
|
||||||
|
|
||||||
if !empty(failed_tests)
|
if !empty(failed_tests)
|
||||||
call Message('')
|
call Message('')
|
||||||
call Message('View generated screendumps with "../../src/vim --clean -S testdir/viewdumps.vim"')
|
call Message('View generated screendumps with "../../src/vim --clean -S testdir/viewdumps.vim"')
|
||||||
|
Reference in New Issue
Block a user