endif
" Names of flaky tests.
-let s:flaky = [
+let s:flaky_tests = [
\ 'Test_call()',
\ 'Test_channel_handler()',
\ 'Test_client_server()',
\ 'Test_zz1_terminal_in_gui()',
\ ]
+" Pattern indicating a common flaky test failure.
+let s:flaky_errors_re = 'StopVimInTerminal'
+
" Locate Test_ functions and execute them.
redir @q
silent function /^Test_
" Repeat a flaky test. Give up when:
" - it fails again with the same message
" - it fails five times (with a different mesage)
- if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
+ if len(v:errors) > 0
+ \ && (index(s:flaky_tests, s:test) >= 0
+ \ || v:errors[0] =~ s:flaky_errors_re)
while 1
call add(s:messages, 'Found errors in ' . s:test . ':')
call extend(s:messages, v:errors)