vim-patch:9.0.0369: a failing flaky test doesn't mention the time

Problem:    A failing flaky test doesn't mention the time.
Solution:   Add the time for debugging.  Improve error message.

06d32a0c17

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq
2023-04-19 10:18:47 +08:00
parent dd8781128f
commit db6812c444
2 changed files with 7 additions and 5 deletions

View File

@@ -434,6 +434,7 @@ for g:testfunc in sort(s:tests)
" A test can set g:test_is_flaky to retry running the test. " A test can set g:test_is_flaky to retry running the test.
let g:test_is_flaky = 0 let g:test_is_flaky = 0
let starttime = strftime("%T")
call RunTheTest(g:testfunc) call RunTheTest(g:testfunc)
" Repeat a flaky test. Give up when: " Repeat a flaky test. Give up when:
@@ -445,10 +446,10 @@ for g:testfunc in sort(s:tests)
\ && (index(s:flaky_tests, g:testfunc) >= 0 \ && (index(s:flaky_tests, g:testfunc) >= 0
\ || g:test_is_flaky) \ || g:test_is_flaky)
while 1 while 1
call add(s:messages, 'Found errors in ' . g:testfunc . ':') call add(s:messages, 'Found errors in ' .. g:testfunc .. ':')
call extend(s:messages, v:errors) call extend(s:messages, v:errors)
call add(total_errors, 'Run ' . g:run_nr . ':') call add(total_errors, starttime .. ' Run ' .. g:run_nr .. ':')
call extend(total_errors, v:errors) call extend(total_errors, v:errors)
if g:run_nr >= 5 || prev_error == v:errors[0] if g:run_nr >= 5 || prev_error == v:errors[0]
@@ -468,6 +469,7 @@ for g:testfunc in sort(s:tests)
let v:errors = [] let v:errors = []
let g:run_nr += 1 let g:run_nr += 1
let starttime = strftime("%T")
call RunTheTest(g:testfunc) call RunTheTest(g:testfunc)
if len(v:errors) == 0 if len(v:errors) == 0

View File

@@ -110,16 +110,16 @@ func RunServer(cmd, testfunc, args)
try try
let g:currentJob = RunCommand(pycmd) let g:currentJob = RunCommand(pycmd)
" Wait for up to 2 seconds for the port number to be there. " Wait for some time for the port number to be there.
let port = GetPort() let port = GetPort()
if port == 0 if port == 0
call assert_false(1, "Can't start " . a:cmd) call assert_report(strftime("%T") .. " Can't start " .. a:cmd)
return return
endif endif
call call(function(a:testfunc), [port]) call call(function(a:testfunc), [port])
catch catch
call assert_false(1, 'Caught exception: "' . v:exception . '" in ' . v:throwpoint) call assert_report('Caught exception: "' . v:exception . '" in ' . v:throwpoint)
finally finally
call s:kill_server(a:cmd) call s:kill_server(a:cmd)
endtry endtry