runtime(syntax-tests): Support "wait-free" test failure
When certain changes guarantee failure for old syntax tests,
opt for faster failure by reducing the number of screendumps
made for each file "page" to be no greater than the assigned
value of a VIM_SYNTAX_TEST_WAIT_TIME environment variable.
(This variable will be ignored and more screendumps may be
made when Make is GNU Make and a parent Makefile is used.)
Barring regressions, and assuming that v9.1.1163~1 succeeds
in providing a correct synchronisation mechanism outside of
"VerifyScreenDump()", and assuming that "readfile()" always
obtains the latest contents written by "term_dumpwrite()" in
"VerifyScreenDump()"; making a single screendump of a file
"page" and following it with a single reading of the written
screendump file should be enough to decide whether to pass
or fail a syntax test.
In addition, re-enable self testing after v9.1.1183~2.
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/testdir/runtest.vim b/runtime/syntax/testdir/runtest.vim
index 19a5e89..4152702 100644
--- a/runtime/syntax/testdir/runtest.vim
+++ b/runtime/syntax/testdir/runtest.vim
@@ -383,7 +383,11 @@
enddef
END
let MAX_FAILED_COUNT = 5
- lockvar MAX_FAILED_COUNT XTESTSCRIPT
+ let DUMP_OPTS = exists("$VIM_SYNTAX_TEST_WAIT_TIME") &&
+ \ !empty($VIM_SYNTAX_TEST_WAIT_TIME)
+ \ ? {'wait': max([1, str2nr($VIM_SYNTAX_TEST_WAIT_TIME)])}
+ \ : {}
+ lockvar DUMP_OPTS MAX_FAILED_COUNT XTESTSCRIPT
let ok_count = 0
let failed_tests = []
let skipped_count = 0
@@ -398,8 +402,8 @@
\ ->join('\|')
\ : ''
- " Treat "\.self-testing$" as a string NOT as a regexp.
- if filter ==# '\.self-testing$'
+ " Treat "^self-testing" as a string NOT as a regexp.
+ if filter ==# '^self-testing'
let dirpath = 'input/selftestdir/'
let fnames = readdir(dirpath, {fname -> fname !~ '^README\.txt$'})
else
@@ -472,7 +476,7 @@
let ruler = s:TermWaitAndPollRuler(buf, 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
- let fail = VerifyScreenDump(buf, root_00, {})
+ let fail = VerifyScreenDump(buf, root_00, DUMP_OPTS)
" Accommodate the next code block to "buf"'s contingency for self
" wipe-out.
@@ -492,7 +496,7 @@
\ in_name_and_out_name)
call ch_log('Next screendump for ' .. in_name_and_out_name)
" Make a screendump of every 18 lines of the file: failed/root_NN.dump
- let fail += VerifyScreenDump(buf, root_next, {})
+ let fail += VerifyScreenDump(buf, root_next, DUMP_OPTS)
endwhile
call StopVimInTerminal(buf)
finally