vim-patch:8.0.0477

Problem:    The client-server test may hang when failing.
Solution:   Set a timer.  Add assert_report()

42205551b1
This commit is contained in:
James McCoy
2017-06-05 23:17:54 -04:00
parent cb8efa4fef
commit dafc14b969
4 changed files with 98 additions and 61 deletions

View File

@@ -76,7 +76,7 @@ set listchars=eol:$
" Prevent Nvim log from writing to stderr.
let $NVIM_LOG_FILE='Xnvim.log'
function RunTheTest(test)
func RunTheTest(test)
echo 'Executing ' . a:test
if exists("*SetUp")
call SetUp()
@@ -113,6 +113,60 @@ function RunTheTest(test)
set nomodified
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
" 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=
if s:fail == 0
" Success, create the .res file so that make knows it's done.
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
write
endif
if len(s:errors) > 0
" Append errors to test.log
split test.log
call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':')
call append(line('$'), s:errors)
write
endif
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
echo message
call add(s:messages, message)
if s:fail > 0
let message = s:fail . ' FAILED:'
echo message
call add(s:messages, message)
call extend(s:messages, s:errors)
endif
" Add SKIPPED messages
call extend(s:messages, s:skipped)
" Append messages to the file "messages"
split messages
call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':')
call append(line('$'), s:messages)
write
qall!
endfunc
" Source the test script. First grab the file name, in case the script
" navigates away. g:testname can be used by the tests.
let g:testname = expand('%')
@@ -157,56 +211,14 @@ for s:test in sort(s:tests)
call RunTheTest(s:test)
if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
call add(s:messages, 'Flaky test failed, running it again')
let v:errors = []
call RunTheTest(s:test)
endif
if len(v:errors) > 0
let s:fail += 1
call add(s:errors, 'Found errors in ' . s:test . ':')
call extend(s:errors, v:errors)
call add(s:messages, 'Flaky test failed, running it again')
let v:errors = []
call RunTheTest(s:test)
endif
call AfterTheTest()
endfor
" Don't write viminfo on exit.
set viminfo=
call FinishTesting()
if s:fail == 0
" Success, create the .res file so that make knows it's done.
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
write
endif
if len(s:errors) > 0
" Append errors to test.log
split test.log
call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':')
call append(line('$'), s:errors)
write
endif
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests': ' test')
echo message
call add(s:messages, message)
if s:fail > 0
let message = s:fail . ' FAILED'
echo message
call add(s:messages, message)
call extend(s:messages, s:errors)
endif
" Add SKIPPED messages
call extend(s:messages, s:skipped)
" Append messages to the file "messages"
split messages
call append(line('$'), '')
call append(line('$'), 'From ' . g:testname . ':')
call append(line('$'), s:messages)
write
qall!
" vim: shiftwidth=2 sts=2 expandtab