forked from aniani/vim
patch 8.2.0423: in some environments a few tests are expected to fail
Problem: In some environments a few tests are expected to fail. Solution: Add $TEST_MAY_FAIL to list tests that should not cause make to fail.
This commit is contained in:
@@ -7,6 +7,19 @@
|
|||||||
" ../vim -u NONE -S runtest.vim test_channel.vim open_delay
|
" ../vim -u NONE -S runtest.vim test_channel.vim open_delay
|
||||||
" The output can be found in the "messages" file.
|
" The output can be found in the "messages" file.
|
||||||
"
|
"
|
||||||
|
" If the environment variable $TEST_FILTER is set then only test functions
|
||||||
|
" matching this pattern are executed. E.g. for sh/bash:
|
||||||
|
" export TEST_FILTER=Test_channel
|
||||||
|
" For csh:
|
||||||
|
" setenv TEST_FILTER Test_channel
|
||||||
|
"
|
||||||
|
" To ignore failure for tests that are known to fail in a certain environment,
|
||||||
|
" set $TEST_MAY_FAIL to a comma separated list of function names. E.g. for
|
||||||
|
" sh/bash:
|
||||||
|
" export TEST_MAY_FAIL=Test_channel_one,Test_channel_other
|
||||||
|
" The failure report will then not be included in the test.log file and
|
||||||
|
" "make test" will not fail.
|
||||||
|
"
|
||||||
" The test script may contain anything, only functions that start with
|
" The test script may contain anything, only functions that start with
|
||||||
" "Test_" are special. These will be invoked and should contain assert
|
" "Test_" are special. These will be invoked and should contain assert
|
||||||
" functions. See test_assert.vim for an example.
|
" functions. See test_assert.vim for an example.
|
||||||
@@ -209,11 +222,17 @@ func RunTheTest(test)
|
|||||||
let s:done += 1
|
let s:done += 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func AfterTheTest()
|
func AfterTheTest(func_name)
|
||||||
if len(v:errors) > 0
|
if len(v:errors) > 0
|
||||||
let s:fail += 1
|
if match(s:may_fail_list, '^' .. a:func_name) >= 0
|
||||||
call add(s:errors, 'Found errors in ' . s:test . ':')
|
let s:fail_expected += 1
|
||||||
call extend(s:errors, v:errors)
|
call add(s:errors_expected, 'Found errors in ' . s:test . ':')
|
||||||
|
call extend(s:errors_expected, v:errors)
|
||||||
|
else
|
||||||
|
let s:fail += 1
|
||||||
|
call add(s:errors, 'Found errors in ' . s:test . ':')
|
||||||
|
call extend(s:errors, v:errors)
|
||||||
|
endif
|
||||||
let v:errors = []
|
let v:errors = []
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
@@ -229,7 +248,7 @@ endfunc
|
|||||||
|
|
||||||
" This function can be called by a test if it wants to abort testing.
|
" This function can be called by a test if it wants to abort testing.
|
||||||
func FinishTesting()
|
func FinishTesting()
|
||||||
call AfterTheTest()
|
call AfterTheTest('')
|
||||||
|
|
||||||
" Don't write viminfo on exit.
|
" Don't write viminfo on exit.
|
||||||
set viminfo=
|
set viminfo=
|
||||||
@@ -237,7 +256,7 @@ func FinishTesting()
|
|||||||
" Clean up files created by setup.vim
|
" Clean up files created by setup.vim
|
||||||
call delete('XfakeHOME', 'rf')
|
call delete('XfakeHOME', 'rf')
|
||||||
|
|
||||||
if s:fail == 0
|
if s:fail == 0 && s:fail_expected == 0
|
||||||
" Success, create the .res file so that make knows it's done.
|
" Success, create the .res file so that make knows it's done.
|
||||||
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
|
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
|
||||||
write
|
write
|
||||||
@@ -275,6 +294,12 @@ func FinishTesting()
|
|||||||
call add(s:messages, message)
|
call add(s:messages, message)
|
||||||
call extend(s:messages, s:errors)
|
call extend(s:messages, s:errors)
|
||||||
endif
|
endif
|
||||||
|
if s:fail_expected > 0
|
||||||
|
let message = s:fail_expected . ' FAILED (matching $TEST_MAY_FAIL):'
|
||||||
|
echo message
|
||||||
|
call add(s:messages, message)
|
||||||
|
call extend(s:messages, s:errors_expected)
|
||||||
|
endif
|
||||||
|
|
||||||
" Add SKIPPED messages
|
" Add SKIPPED messages
|
||||||
call extend(s:messages, s:skipped)
|
call extend(s:messages, s:skipped)
|
||||||
@@ -294,11 +319,13 @@ endfunc
|
|||||||
let g:testname = expand('%')
|
let g:testname = expand('%')
|
||||||
let s:done = 0
|
let s:done = 0
|
||||||
let s:fail = 0
|
let s:fail = 0
|
||||||
|
let s:fail_expected = 0
|
||||||
let s:errors = []
|
let s:errors = []
|
||||||
|
let s:errors_expected = []
|
||||||
let s:messages = []
|
let s:messages = []
|
||||||
let s:skipped = []
|
let s:skipped = []
|
||||||
if expand('%') =~ 'test_vimscript.vim'
|
if expand('%') =~ 'test_vimscript.vim'
|
||||||
" this test has intentional s:errors, don't use try/catch.
|
" this test has intentional errors, don't use try/catch.
|
||||||
source %
|
source %
|
||||||
else
|
else
|
||||||
try
|
try
|
||||||
@@ -367,6 +394,12 @@ if $TEST_FILTER != ''
|
|||||||
let s:filtered -= len(s:tests)
|
let s:filtered -= len(s:tests)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:may_fail_list = []
|
||||||
|
if $TEST_MAY_FAIL != ''
|
||||||
|
" Split the list at commas and add () to make it match s:test.
|
||||||
|
let s:may_fail_list = split($TEST_MAY_FAIL, ',')->map({i, v -> v .. '()'})
|
||||||
|
endif
|
||||||
|
|
||||||
" Execute the tests in alphabetical order.
|
" Execute the tests in alphabetical order.
|
||||||
for s:test in sort(s:tests)
|
for s:test in sort(s:tests)
|
||||||
" Silence, please!
|
" Silence, please!
|
||||||
@@ -419,7 +452,7 @@ for s:test in sort(s:tests)
|
|||||||
endwhile
|
endwhile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call AfterTheTest()
|
call AfterTheTest(s:test)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call FinishTesting()
|
call FinishTesting()
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
423,
|
||||||
/**/
|
/**/
|
||||||
422,
|
422,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user