1
0
forked from aniani/vim

patch 8.2.1013: channel tests can be a bit flaky

Problem:    Channel tests can be a bit flaky.
Solution:   Set the g:test_is_flaky flag in SetUp().
This commit is contained in:
Bram Moolenaar
2020-06-19 19:10:59 +02:00
parent 3b74b6b4bb
commit ec9b017b87
2 changed files with 11 additions and 13 deletions

View File

@@ -29,14 +29,14 @@ func SetUp()
endif endif
let s:chopt = {} let s:chopt = {}
call ch_log(g:testfunc) call ch_log(g:testfunc)
" Most tests use job_start(), which can be flaky
let g:test_is_flaky = 1
endfunc endfunc
" Run "testfunc" after starting the server and stop the server afterwards. " Run "testfunc" after starting the server and stop the server afterwards.
func s:run_server(testfunc, ...) func s:run_server(testfunc, ...)
call RunServer(s:testscript, a:testfunc, a:000) call RunServer(s:testscript, a:testfunc, a:000)
" communicating with a server can be flaky
let g:test_is_flaky = 1
endfunc endfunc
" Return a list of open files. " Return a list of open files.
@@ -455,7 +455,6 @@ endfunc
func Test_connect_waittime() func Test_connect_waittime()
CheckFunction reltimefloat CheckFunction reltimefloat
" this is timing sensitive " this is timing sensitive
let g:test_is_flaky = 1
let start = reltime() let start = reltime()
let handle = ch_open('localhost:9876', s:chopt) let handle = ch_open('localhost:9876', s:chopt)
@@ -1762,9 +1761,8 @@ func Test_write_to_deleted_buffer()
endfunc endfunc
func Test_cmd_parsing() func Test_cmd_parsing()
if !has('unix') CheckUnix
return
endif
call assert_false(filereadable("file with space")) call assert_false(filereadable("file with space"))
let job = job_start('touch "file with space"') let job = job_start('touch "file with space"')
call WaitForAssert({-> assert_true(filereadable("file with space"))}) call WaitForAssert({-> assert_true(filereadable("file with space"))})
@@ -1963,9 +1961,7 @@ func Test_list_args()
endfunc endfunc
func Test_keep_pty_open() func Test_keep_pty_open()
if !has('unix') CheckUnix
return
endif
let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"', let job = job_start(s:python . ' -c "import time;time.sleep(0.2)"',
\ {'out_io': 'null', 'err_io': 'null', 'pty': 1}) \ {'out_io': 'null', 'err_io': 'null', 'pty': 1})
@@ -2047,9 +2043,7 @@ func Test_no_hang_windows()
endfunc endfunc
func Test_job_exitval_and_termsig() func Test_job_exitval_and_termsig()
if !has('unix') CheckUnix
return
endif
" Terminate job normally " Terminate job normally
let cmd = ['echo'] let cmd = ['echo']
@@ -2123,6 +2117,7 @@ endfunc
" Do this last, it stops any channel log. " Do this last, it stops any channel log.
func Test_zz_nl_err_to_out_pipe() func Test_zz_nl_err_to_out_pipe()
eval 'Xlog'->ch_logfile() eval 'Xlog'->ch_logfile()
call ch_log('Test_zz_nl_err_to_out_pipe()') call ch_log('Test_zz_nl_err_to_out_pipe()')
let job = job_start(s:python . " test_channel_pipe.py", {'err_io': 'out'}) let job = job_start(s:python . " test_channel_pipe.py", {'err_io': 'out'})
@@ -2214,6 +2209,7 @@ endfunc
func Test_job_trailing_space_unix() func Test_job_trailing_space_unix()
CheckUnix CheckUnix
CheckExecutable cat CheckExecutable cat
let job = job_start("cat ", #{in_io: 'null'}) let job = job_start("cat ", #{in_io: 'null'})
call WaitForAssert({-> assert_equal("dead", job_status(job))}) call WaitForAssert({-> assert_equal("dead", job_status(job))})
call assert_equal(0, job_info(job).exitval) call assert_equal(0, job_info(job).exitval)

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1013,
/**/ /**/
1012, 1012,
/**/ /**/