To: vim_dev@googlegroups.com Subject: Patch 8.2.0423 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0423 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. Files: src/testdir/runtest.vim *** ../vim-8.2.0422/src/testdir/runtest.vim 2020-03-19 19:44:29.159344074 +0100 --- src/testdir/runtest.vim 2020-03-21 15:16:33.160867200 +0100 *************** *** 7,12 **** --- 7,25 ---- " ../vim -u NONE -S runtest.vim test_channel.vim open_delay " 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 " "Test_" are special. These will be invoked and should contain assert " functions. See test_assert.vim for an example. *************** *** 209,219 **** let s:done += 1 endfunc ! func AfterTheTest() if len(v:errors) > 0 ! let s:fail += 1 ! call add(s:errors, 'Found errors in ' . s:test . ':') ! call extend(s:errors, v:errors) let v:errors = [] endif endfunc --- 222,238 ---- let s:done += 1 endfunc ! func AfterTheTest(func_name) if len(v:errors) > 0 ! if match(s:may_fail_list, '^' .. a:func_name) >= 0 ! let s:fail_expected += 1 ! 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 = [] endif endfunc *************** *** 229,235 **** " This function can be called by a test if it wants to abort testing. func FinishTesting() ! call AfterTheTest() " Don't write viminfo on exit. set viminfo= --- 248,254 ---- " This function can be called by a test if it wants to abort testing. func FinishTesting() ! call AfterTheTest('') " Don't write viminfo on exit. set viminfo= *************** *** 237,243 **** " Clean up files created by setup.vim call delete('XfakeHOME', 'rf') ! if s:fail == 0 " Success, create the .res file so that make knows it's done. exe 'split ' . fnamemodify(g:testname, ':r') . '.res' write --- 256,262 ---- " Clean up files created by setup.vim call delete('XfakeHOME', 'rf') ! if s:fail == 0 && s:fail_expected == 0 " Success, create the .res file so that make knows it's done. exe 'split ' . fnamemodify(g:testname, ':r') . '.res' write *************** *** 275,280 **** --- 294,305 ---- call add(s:messages, message) call extend(s:messages, s:errors) 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 call extend(s:messages, s:skipped) *************** *** 294,304 **** let g:testname = expand('%') let s:done = 0 let s:fail = 0 let s:errors = [] let s:messages = [] let s:skipped = [] if expand('%') =~ 'test_vimscript.vim' ! " this test has intentional s:errors, don't use try/catch. source % else try --- 319,331 ---- let g:testname = expand('%') let s:done = 0 let s:fail = 0 + let s:fail_expected = 0 let s:errors = [] + let s:errors_expected = [] let s:messages = [] let s:skipped = [] if expand('%') =~ 'test_vimscript.vim' ! " this test has intentional errors, don't use try/catch. source % else try *************** *** 367,372 **** --- 394,405 ---- let s:filtered -= len(s:tests) 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. for s:test in sort(s:tests) " Silence, please! *************** *** 419,425 **** endwhile endif ! call AfterTheTest() endfor call FinishTesting() --- 452,458 ---- endwhile endif ! call AfterTheTest(s:test) endfor call FinishTesting() *** ../vim-8.2.0422/src/version.c 2020-03-20 21:15:47.918287657 +0100 --- src/version.c 2020-03-21 15:14:51.041198983 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 423, /**/ -- Not too long ago, a program was something you watched on TV... /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///