mirror of
https://github.com/vim/vim.git
synced 2025-10-09 06:14:17 -04:00
patch 8.1.0820: test for sending large data over channel sometimes fails
Problem: Test for sending large data over channel sometimes fails. Solution: Handle that the job may have finished early. Also fix that file changed test doesn't work in the GUI and reduce flakyness. (Ozaki Kiichi, closes #3861)
This commit is contained in:
@@ -966,15 +966,15 @@ func Run_pipe_through_sort(all, use_buffer)
|
||||
let options.in_top = 2
|
||||
let options.in_bot = 4
|
||||
endif
|
||||
let g:job = job_start('sort', options)
|
||||
let job = job_start('sort', options)
|
||||
|
||||
if !a:use_buffer
|
||||
call assert_equal("run", job_status(g:job))
|
||||
call ch_sendraw(g:job, "ccc\naaa\nddd\nbbb\neee\n")
|
||||
call ch_close_in(g:job)
|
||||
call assert_equal("run", job_status(job))
|
||||
call ch_sendraw(job, "ccc\naaa\nddd\nbbb\neee\n")
|
||||
call ch_close_in(job)
|
||||
endif
|
||||
|
||||
call WaitForAssert({-> assert_equal("dead", job_status(g:job))})
|
||||
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
||||
|
||||
sp sortout
|
||||
call WaitFor('line("$") > 3')
|
||||
@@ -985,8 +985,7 @@ func Run_pipe_through_sort(all, use_buffer)
|
||||
call assert_equal(['aaa', 'bbb', 'ddd'], getline(2, 4))
|
||||
endif
|
||||
|
||||
call job_stop(g:job)
|
||||
unlet g:job
|
||||
call job_stop(job)
|
||||
if a:use_buffer
|
||||
bwipe! sortin
|
||||
endif
|
||||
@@ -1186,7 +1185,8 @@ func Test_pipe_to_buffer_raw()
|
||||
split testout
|
||||
let job = job_start([s:python, '-c',
|
||||
\ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in range(10000)]'], options)
|
||||
call assert_equal("run", job_status(job))
|
||||
" the job may be done quickly, also accept "dead"
|
||||
call assert_match('^\%(dead\|run\)$', job_status(job))
|
||||
call WaitFor('len(join(getline(1, "$"), "")) >= 10000')
|
||||
try
|
||||
let totlen = 0
|
||||
@@ -1291,7 +1291,8 @@ func Test_out_close_cb()
|
||||
let job = job_start(s:python . " test_channel_pipe.py quit now",
|
||||
\ {'out_cb': 'OutHandler',
|
||||
\ 'close_cb': 'CloseHandler'})
|
||||
call assert_equal("run", job_status(job))
|
||||
" the job may be done quickly, also accept "dead"
|
||||
call assert_match('^\%(dead\|run\)$', job_status(job))
|
||||
try
|
||||
call WaitForAssert({-> assert_equal('quit', g:Ch_msg1)})
|
||||
call WaitForAssert({-> assert_equal(2, g:Ch_closemsg)})
|
||||
@@ -1314,7 +1315,8 @@ func Test_read_in_close_cb()
|
||||
endfunc
|
||||
let job = job_start(s:python . " test_channel_pipe.py quit now",
|
||||
\ {'close_cb': 'CloseHandler'})
|
||||
call assert_equal("run", job_status(job))
|
||||
" the job may be done quickly, also accept "dead"
|
||||
call assert_match('^\%(dead\|run\)$', job_status(job))
|
||||
try
|
||||
call WaitForAssert({-> assert_equal('quit', g:Ch_received)})
|
||||
finally
|
||||
@@ -1338,7 +1340,8 @@ func Test_read_in_close_cb_incomplete()
|
||||
endfunc
|
||||
let job = job_start(s:python . " test_channel_pipe.py incomplete",
|
||||
\ {'close_cb': 'CloseHandler'})
|
||||
call assert_equal("run", job_status(job))
|
||||
" the job may be done quickly, also accept "dead"
|
||||
call assert_match('^\%(dead\|run\)$', job_status(job))
|
||||
try
|
||||
call WaitForAssert({-> assert_equal('incomplete', g:Ch_received)})
|
||||
finally
|
||||
@@ -1385,14 +1388,13 @@ func Test_close_and_exit_cb()
|
||||
let self.ret['exit_cb'] = job_status(a:job)
|
||||
endfunc
|
||||
|
||||
let g:job = job_start(has('win32') ? 'cmd /c echo:' : 'echo', {
|
||||
\ 'close_cb': g:retdict.close_cb,
|
||||
\ 'exit_cb': g:retdict.exit_cb,
|
||||
\ })
|
||||
call assert_equal('run', job_status(g:job))
|
||||
unlet g:job
|
||||
let job = job_start([&shell, &shellcmdflag, 'echo'],
|
||||
\ {'close_cb': g:retdict.close_cb,
|
||||
\ 'exit_cb': g:retdict.exit_cb})
|
||||
" the job may be done quickly, also accept "dead"
|
||||
call assert_match('^\%(dead\|run\)$', job_status(job))
|
||||
call WaitForAssert({-> assert_equal(2, len(g:retdict.ret))})
|
||||
call assert_match('^\%(dead\|run\)', g:retdict.ret['close_cb'])
|
||||
call assert_match('^\%(dead\|run\)$', g:retdict.ret['close_cb'])
|
||||
call assert_equal('dead', g:retdict.ret['exit_cb'])
|
||||
unlet g:retdict
|
||||
endfunc
|
||||
@@ -1933,7 +1935,8 @@ func Test_keep_pty_open()
|
||||
return
|
||||
endif
|
||||
|
||||
let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', {'out_io': 'null', 'err_io': 'null', 'pty': 1})
|
||||
let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"',
|
||||
\ {'out_io': 'null', 'err_io': 'null', 'pty': 1})
|
||||
let elapsed = WaitFor({-> job_status(job) ==# 'dead'})
|
||||
call assert_inrange(200, 1000, elapsed)
|
||||
call job_stop(job)
|
||||
@@ -1988,10 +1991,11 @@ func Test_raw_large_data()
|
||||
\ {'mode': 'raw', 'drop': 'never', 'noblock': 1,
|
||||
\ 'callback': {ch, msg -> execute('let g:out .= msg')}})
|
||||
|
||||
let want = repeat('X', 79999) . "\n"
|
||||
let outlen = 79999
|
||||
let want = repeat('X', outlen) . "\n"
|
||||
call ch_sendraw(job, want)
|
||||
let g:Ch_job = job
|
||||
call WaitForAssert({-> assert_equal("dead", job_status(g:Ch_job))})
|
||||
call WaitFor({-> len(g:out) >= outlen}, 10000)
|
||||
call WaitForAssert({-> assert_equal("dead", job_status(job))})
|
||||
call assert_equal(want, substitute(g:out, '\r', '', 'g'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
|
@@ -90,7 +90,7 @@ func Test_FileChangedShell_reload()
|
||||
endfunc
|
||||
|
||||
func Test_file_changed_dialog()
|
||||
if !has('unix')
|
||||
if !has('unix') || has('gui_running')
|
||||
return
|
||||
endif
|
||||
au! FileChangedShell
|
||||
|
@@ -787,6 +787,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
820,
|
||||
/**/
|
||||
819,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user