Skip to content

Commit b5459ee

Browse files
zzzyxwvutchrisbra
authored andcommitted
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>
1 parent 4e7b430 commit b5459ee

4 files changed

Lines changed: 23 additions & 12 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ src/json_test
9696
src/message_test
9797
src/kword_test
9898

99-
runtime/syntax/testdir/Xfilter
10099
runtime/syntax/testdir/done/
101-
runtime/syntax/testdir/failed/
102100
runtime/syntax/testdir/messages
103101
runtime/syntax/testdir/testdeps.mk
104102
runtime/syntax/testdir/vimcmd

.hgignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ src/json_test
9898
src/message_test
9999
src/kword_test
100100

101-
runtime/syntax/testdir/Xfilter
102101
runtime/syntax/testdir/done/
103-
runtime/syntax/testdir/failed/
104102
runtime/syntax/testdir/messages
105103
runtime/syntax/testdir/testdeps.mk
106104
runtime/syntax/testdir/vimcmd

runtime/syntax/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ test:
4343
@#mkdir -p testdir/failed
4444
@#touch "$(VIM_SYNTAX_TEST_LOG)"
4545
VIMRUNTIME=$(VIMRUNTIME) $(ENVVARS) $(VIMPROG) --clean --not-a-term $(DEBUGLOG) -u testdir/runtest.vim > /dev/null
46-
@rm -f testdir/Xfilter
4746
@# FIXME: Temporarily show the whole file to find out what goes wrong
4847
@#if [ -f testdir/messages ]; then tail -n 6 testdir/messages; fi
4948
@if [ -f testdir/messages ]; then cat testdir/messages; fi

runtime/syntax/testdir/runtest.vim

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,18 +389,21 @@ func RunTest()
389389
\ : {}
390390
lockvar DUMP_OPTS MAX_FAILED_COUNT XTESTSCRIPT
391391
let ok_count = 0
392+
let disused_pages = []
392393
let failed_tests = []
393394
let skipped_count = 0
394395
let last_test_status = 'invalid'
396+
let filter = ''
395397
" Create a map of setup configuration filenames with their basenames as keys.
396398
let setup = glob('input/setup/*.vim', 1, 1)
397399
\ ->reduce({d, f -> extend(d, {fnamemodify(f, ':t:r'): f})}, {})
398400
" Turn a subset of filenames etc. requested for testing into a pattern.
399-
let filter = filereadable('../testdir/Xfilter')
400-
\ ? readfile('../testdir/Xfilter')
401-
\ ->map({_, v -> '^' .. substitute(v, '_$', '', '')})
401+
if filereadable('../testdir/Xfilter')
402+
let filter = readfile('../testdir/Xfilter')
403+
\ ->map({_, v -> '^' .. escape(substitute(v, '_$', '', ''), '.')})
402404
\ ->join('\|')
403-
\ : ''
405+
call delete('../testdir/Xfilter')
406+
endif
404407

405408
" Treat "^self-testing" as a string NOT as a regexp.
406409
if filter ==# '^self-testing'
@@ -430,8 +433,8 @@ func RunTest()
430433
let filetype = substitute(root, '\([^_.]*\)[_.].*', '\1', '')
431434
let failed_root = 'failed/' .. root
432435

433-
for dumpname in glob(failed_root .. '_\d*\.dump', 1, 1)
434-
call delete(dumpname)
436+
for pagename in glob(failed_root .. '_\d*\.dump', 1, 1)
437+
call delete(pagename)
435438
endfor
436439
call delete('done/' .. root)
437440
call writefile(XTESTSCRIPT, 'Xtestscript')
@@ -477,11 +480,11 @@ func RunTest()
477480
call ch_log('First screendump for ' .. in_name_and_out_name)
478481
" Make a screendump at the start of the file: failed/root_00.dump
479482
let fail = VerifyScreenDump(buf, root_00, DUMP_OPTS)
483+
let nr = 0
480484

481485
" Accommodate the next code block to "buf"'s contingency for self
482486
" wipe-out.
483487
try
484-
let nr = 0
485488
let keys_a = ":call ScrollToSecondPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
486489
let keys_b = ":call ScrollToNextPage((18 * 75 + 1), 19, 5) | redraw!\<CR>"
487490
while s:CannotSeeLastLine(ruler)
@@ -503,6 +506,15 @@ func RunTest()
503506
call delete('Xtestscript')
504507
endtry
505508

509+
let nr += 1
510+
let pagename = printf('dumps/%s_%02d.dump', root, nr)
511+
512+
while filereadable(pagename)
513+
call add(disused_pages, pagename)
514+
let nr += 1
515+
let pagename = printf('dumps/%s_%02d.dump', root, nr)
516+
endwhile
517+
506518
" redraw here to avoid the following messages to get mixed up with screen
507519
" output.
508520
redraw
@@ -573,6 +585,10 @@ func RunTest()
573585
call Message('FAILED: ' .. len(failed_tests) .. ': ' .. string(failed_tests))
574586
call Message('skipped: ' .. skipped_count)
575587

588+
for pagename in disused_pages
589+
call Message(printf('No input page found for "%s"', pagename))
590+
endfor
591+
576592
if !empty(failed_tests)
577593
call Message('')
578594
call Message('View generated screendumps with "../../src/vim --clean -S testdir/viewdumps.vim"')

0 commit comments

Comments
 (0)