To: vim_dev@googlegroups.com Subject: Patch 8.0.1697 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1697 Problem: Various tests are still a bit flaky. Solution: Increase the default wait time to five seconds. Files: src/testdir/shared.vim, src/testdir/screendump.vim, src/testdir/test_channel.vim, src/testdir/test_clientserver.vim, src/testdir/test_quotestar.vim, src/testdir/test_terminal.vim *** ../vim-8.0.1696/src/testdir/shared.vim 2018-03-13 15:43:43.104617314 +0100 --- src/testdir/shared.vim 2018-04-11 20:44:36.633158021 +0200 *************** *** 113,126 **** endif endfunc ! " Wait for up to a second for "expr" to become true. "expr" can be a " stringified expression to evaluate, or a funcref without arguments. " A second argument can be used to specify a different timeout in msec. " " Return time slept in milliseconds. With the +reltime feature this can be " more than the actual waiting time. Without +reltime it can also be less. func WaitFor(expr, ...) ! let timeout = get(a:000, 0, 1000) " using reltime() is more accurate, but not always available if has('reltime') let start = reltime() --- 113,126 ---- endif endfunc ! " Wait for up to five seconds for "expr" to become true. "expr" can be a " stringified expression to evaluate, or a funcref without arguments. " A second argument can be used to specify a different timeout in msec. " " Return time slept in milliseconds. With the +reltime feature this can be " more than the actual waiting time. Without +reltime it can also be less. func WaitFor(expr, ...) ! let timeout = get(a:000, 0, 5000) " using reltime() is more accurate, but not always available if has('reltime') let start = reltime() *** ../vim-8.0.1696/src/testdir/screendump.vim 2018-04-10 21:43:22.422651857 +0200 --- src/testdir/screendump.vim 2018-04-11 20:46:20.308400032 +0200 *************** *** 60,67 **** call assert_equal([rows, cols], term_getsize(buf)) " Wait for "All" of the ruler in the status line to be shown. ! " This can be quite slow (e.g. when using valgrind), wait up to 4 seconds. ! call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}, 4000) return buf endfunc --- 60,67 ---- call assert_equal([rows, cols], term_getsize(buf)) " Wait for "All" of the ruler in the status line to be shown. ! " This can be quite slow (e.g. when using valgrind). ! call WaitFor({-> len(term_getline(buf, rows)) >= cols - 1}) return buf endfunc *************** *** 70,76 **** func StopVimInTerminal(buf) call assert_equal("running", term_getstatus(a:buf)) call term_sendkeys(a:buf, "\\:qa!\") ! call WaitFor('term_getstatus(' . a:buf . ') == "finished"', 3000) only! endfunc --- 70,76 ---- func StopVimInTerminal(buf) call assert_equal("running", term_getstatus(a:buf)) call term_sendkeys(a:buf, "\\:qa!\") ! call WaitFor('term_getstatus(' . a:buf . ') == "finished"') only! endfunc *** ../vim-8.0.1696/src/testdir/test_channel.vim 2018-04-07 13:22:15.566979906 +0200 --- src/testdir/test_channel.vim 2018-04-11 20:47:09.992039738 +0200 *************** *** 1143,1149 **** 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)) ! call WaitFor('len(join(getline(1, "$"), "")) >= 10000', 3000) try let totlen = 0 for line in getline(1, '$') --- 1143,1149 ---- 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)) ! call WaitFor('len(join(getline(1, "$"), "")) >= 10000') try let totlen = 0 for line in getline(1, '$') *************** *** 1506,1512 **** let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} let job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) let g:exit_cb_val.process = job_info(job).process ! call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0', 2000) let elapsed = reltimefloat(g:exit_cb_val.end) call assert_true(elapsed > 0.5) call assert_true(elapsed < 1.0) --- 1506,1512 ---- let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} let job = job_start([s:python, '-c', 'import time;time.sleep(0.5)'], {'exit_cb': 'MyExitTimeCb'}) let g:exit_cb_val.process = job_info(job).process ! call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') let elapsed = reltimefloat(g:exit_cb_val.end) call assert_true(elapsed > 0.5) call assert_true(elapsed < 1.0) *** ../vim-8.0.1696/src/testdir/test_clientserver.vim 2017-11-04 19:24:24.754197129 +0100 --- src/testdir/test_clientserver.vim 2018-04-11 20:47:17.179987756 +0200 *************** *** 32,38 **** " Takes a short while for the server to be active. " When using valgrind it takes much longer. ! call WaitFor('serverlist() =~ "' . name . '"', 5000) call assert_match(name, serverlist()) call remote_foreground(name) --- 32,38 ---- " Takes a short while for the server to be active. " When using valgrind it takes much longer. ! call WaitFor('serverlist() =~ "' . name . '"') call assert_match(name, serverlist()) call remote_foreground(name) *** ../vim-8.0.1696/src/testdir/test_quotestar.vim 2018-02-24 17:42:22.672168648 +0100 --- src/testdir/test_quotestar.vim 2018-04-11 20:48:34.027434061 +0200 *************** *** 74,93 **** " by the server. let @* = 'no' call remote_foreground(name) ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"', 3000) " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\") ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"', 3000) " Check that the *-register of this vim instance is changed as expected. ! call WaitFor('@* == "yes"', 3000) " Handle the large selection over 262040 byte. let length = 262044 let sample = 'a' . repeat('b', length - 2) . 'c' let @* = sample ! call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)', 3000) let res = remote_expr(name, "@*", "", 2) call assert_equal(length, len(res)) " Check length to prevent a large amount of output at assertion failure. --- 74,93 ---- " by the server. let @* = 'no' call remote_foreground(name) ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\") ! call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') " Check that the *-register of this vim instance is changed as expected. ! call WaitFor('@* == "yes"') " Handle the large selection over 262040 byte. let length = 262044 let sample = 'a' . repeat('b', length - 2) . 'c' let @* = sample ! call WaitFor('remote_expr("' . name . '", "len(@*) >= ' . length . '", "", 1)') let res = remote_expr(name, "@*", "", 2) call assert_equal(length, len(res)) " Check length to prevent a large amount of output at assertion failure. *** ../vim-8.0.1696/src/testdir/test_terminal.vim 2018-04-10 15:59:04.295392601 +0200 --- src/testdir/test_terminal.vim 2018-04-11 20:49:38.354973210 +0200 *************** *** 1061,1067 **** \ "set t_ts=", \ ], 'Xscript') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitFor({-> bufnr('Xtextfile') > 0}, 5000) call assert_equal('Xtextfile', expand('%:t')) call assert_true(winnr('$') >= 3) return buf --- 1061,1067 ---- \ "set t_ts=", \ ], 'Xscript') let buf = RunVimInTerminal('-S Xscript', {}) ! call WaitFor({-> bufnr('Xtextfile') > 0}) call assert_equal('Xtextfile', expand('%:t')) call assert_true(winnr('$') >= 3) return buf *** ../vim-8.0.1696/src/version.c 2018-04-11 10:06:00.731165066 +0200 --- src/version.c 2018-04-11 20:45:28.260779451 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1697, /**/ -- Send $25.00 for handy leaflet on how to make money by selling leaflets /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///