summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-25 21:01:17 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-25 21:01:17 +0100
commite295609be20c1b065d6b489214d70e171ae49234 (patch)
treea4ce1f2561806903d3b76272fa78ab5e7477b334
parent865767126e97d9ac65e052a657b29bbc32dcb512 (diff)
downloadvim-git-e295609be20c1b065d6b489214d70e171ae49234.tar.gz
patch 8.1.0820: test for sending large data over channel sometimes failsv8.1.0820
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)
-rw-r--r--src/testdir/test_channel.vim78
-rw-r--r--src/testdir/test_filechanged.vim2
-rw-r--r--src/version.c2
3 files changed, 44 insertions, 38 deletions
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index e7fcf9582..7b0a91735 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -879,19 +879,19 @@ endfunc
func Test_pipe_err_to_buffer_name()
call Run_test_pipe_err_to_buffer(1, 0, 1)
endfunc
-
+
func Test_pipe_err_to_buffer_nr()
call Run_test_pipe_err_to_buffer(0, 0, 1)
endfunc
-
+
func Test_pipe_err_to_buffer_name_nomod()
call Run_test_pipe_err_to_buffer(1, 1, 1)
endfunc
-
+
func Test_pipe_err_to_buffer_name_nomsg()
call Run_test_pipe_err_to_buffer(1, 0, 0)
endfunc
-
+
func Test_pipe_both_to_buffer()
if !has('job')
return
@@ -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
@@ -1247,9 +1247,9 @@ func Test_out_cb()
endfunc
let job = job_start(s:python . " test_channel_pipe.py",
\ {'out_cb': dict.outHandler,
- \ 'out_mode': 'json',
- \ 'err_cb': dict.errHandler,
- \ 'err_mode': 'json'})
+ \ 'out_mode': 'json',
+ \ 'err_cb': dict.errHandler,
+ \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
@@ -1290,8 +1290,9 @@ func Test_out_close_cb()
endfunc
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))
+ \ 'close_cb': 'CloseHandler'})
+ " 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
@@ -1354,10 +1357,10 @@ func Test_out_cb_lambda()
call ch_log('Test_out_cb_lambda()')
let job = job_start(s:python . " test_channel_pipe.py",
- \ {'out_cb': {ch, msg -> execute("let g:Ch_outmsg = 'lambda: ' . msg")},
- \ 'out_mode': 'json',
- \ 'err_cb': {ch, msg -> execute(":let g:Ch_errmsg = 'lambda: ' . msg")},
- \ 'err_mode': 'json'})
+ \ {'out_cb': {ch, msg -> execute("let g:Ch_outmsg = 'lambda: ' . msg")},
+ \ 'out_mode': 'json',
+ \ 'err_cb': {ch, msg -> execute(":let g:Ch_errmsg = 'lambda: ' . msg")},
+ \ 'err_mode': 'json'})
call assert_equal("run", job_status(job))
try
let g:Ch_outmsg = ''
@@ -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
@@ -1415,7 +1417,7 @@ func Test_exit_cb_wipes_buf()
let g:wipe_buf = bufnr('')
let job = job_start(has('win32') ? 'cmd /c echo:' : ['true'],
- \ {'exit_cb': 'ExitCbWipe'})
+ \ {'exit_cb': 'ExitCbWipe'})
let timer = timer_start(300, {-> feedkeys("\<Esc>", 'nt')}, {'repeat': 5})
call feedkeys(repeat('g', 1000) . 'o', 'ntx!')
call WaitForAssert({-> assert_equal("dead", job_status(job))})
@@ -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)
@@ -1985,13 +1988,14 @@ func Test_raw_large_data()
try
let g:out = ''
let job = job_start(s:python . " test_channel_pipe.py",
- \ {'mode': 'raw', 'drop': 'never', 'noblock': 1,
- \ 'callback': {ch, msg -> execute('let g:out .= msg')}})
+ \ {'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)
diff --git a/src/testdir/test_filechanged.vim b/src/testdir/test_filechanged.vim
index ab34420b4..43f752d27 100644
--- a/src/testdir/test_filechanged.vim
+++ b/src/testdir/test_filechanged.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 3a75c99fc..e999fd19f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -788,6 +788,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 820,
+/**/
819,
/**/
818,