vim-patch:8.0.0495: quotestar test uses timer instead of timeout

Problem:    The quotestar test uses a timer instead of a timeout, thus it
            cannot be rerun like a flaky test.
Solution:   Remove the timer and add a timeout. (Kazunobu Kuriyama)
f5610da7a8
This commit is contained in:
lonerover
2018-05-20 10:27:03 +08:00
parent 3046f4499b
commit 4dd614e51a
2 changed files with 8 additions and 28 deletions

View File

@@ -6,12 +6,6 @@ endif
source shared.vim source shared.vim
let s:where = 0
func Abort(id)
call assert_report('Test timed out at ' . s:where)
call FinishTesting()
endfunc
func Do_test_quotestar_for_macunix() func Do_test_quotestar_for_macunix()
if empty(exepath('pbcopy')) || empty(exepath('pbpaste')) if empty(exepath('pbcopy')) || empty(exepath('pbpaste'))
return 'Test requires pbcopy(1) and pbpaste(1)' return 'Test requires pbcopy(1) and pbpaste(1)'
@@ -46,10 +40,6 @@ func Do_test_quotestar_for_x11()
return 'GetVimCommand() failed' return 'GetVimCommand() failed'
endif endif
" Some of these commands may hang when failing.
call timer_start(10000, 'Abort')
let s:where = 1
let name = 'XVIMCLIPBOARD' let name = 'XVIMCLIPBOARD'
let cmd .= ' --servername ' . name let cmd .= ' --servername ' . name
let g:job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) let g:job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'})
@@ -58,25 +48,19 @@ func Do_test_quotestar_for_x11()
call assert_report('Cannot run the Vim server') call assert_report('Cannot run the Vim server')
return '' return ''
endif endif
let s:where = 2
" Takes a short while for the server to be active. " Takes a short while for the server to be active.
call WaitFor('serverlist() =~ "' . name . '"') call WaitFor('serverlist() =~ "' . name . '"')
call assert_match(name, serverlist()) call assert_match(name, serverlist())
let s:where = 3
" Clear the *-register of this vim instance. " Clear the *-register of this vim instance.
let @* = '' let @* = ''
" Try to change the *-register of the server. " Try to change the *-register of the server.
call remote_foreground(name) call remote_foreground(name)
let s:where = 4
call remote_send(name, ":let @* = 'yes'\<CR>") call remote_send(name, ":let @* = 'yes'\<CR>")
let s:where = 5 call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"')
call WaitFor('remote_expr("' . name . '", "@*") == "yes"') call assert_equal('yes', remote_expr(name, "@*", "", 2))
let s:where = 6
call assert_equal('yes', remote_expr(name, "@*"))
let s:where = 7
" Check that the *-register of this vim instance is changed as expected. " Check that the *-register of this vim instance is changed as expected.
call assert_equal('yes', @*) call assert_equal('yes', @*)
@@ -94,22 +78,18 @@ func Do_test_quotestar_for_x11()
else else
call remote_send(name, ":gui -f\<CR>") call remote_send(name, ":gui -f\<CR>")
endif endif
let s:where = 8 " Wait for the server to be up and answering requests.
sleep 500m call WaitFor('remote_expr("' . name . '", "v:version", "", 1) != ""')
call remote_send(name, ":let @* = 'maybe'\<CR>") call remote_send(name, ":let @* = 'maybe'\<CR>")
let s:where = 9 call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"')
call WaitFor('remote_expr("' . name . '", "@*") == "maybe"') call assert_equal('maybe', remote_expr(name, "@*", "", 2))
let s:where = 10
call assert_equal('maybe', remote_expr(name, "@*"))
let s:where = 11
call assert_equal('maybe', @*) call assert_equal('maybe', @*)
endif endif
call remote_send(name, ":qa!\<CR>") call remote_send(name, ":qa!\<CR>")
let s:where = 12
call WaitFor('job_status(g:job) == "dead"') call WaitFor('job_status(g:job) == "dead"')
let s:where = 13
if job_status(g:job) != 'dead' if job_status(g:job) != 'dead'
call assert_report('Server did not exit') call assert_report('Server did not exit')
call job_stop(g:job, 'kill') call job_stop(g:job, 'kill')

View File

@@ -1144,7 +1144,7 @@ static const int included_patches[] = {
498, 498,
// 497, // 497,
// 496, // 496,
// 495, 495,
// 494, // 494,
// 493, // 493,
// 492, // 492,