From ff37916b47658d16cdec6932aa8aaa3b5af674b7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 21 Aug 2023 14:45:33 +0800 Subject: vim-patch:8.2.0454: some tests fail when the system is slow Problem: Some tests fail when the system is slow. Solution: Make the run number global, use in the test to increase the waiting time. (closes vim/vim#5841) https://github.com/vim/vim/commit/3ed9efc2b15b624268bcce4e4d312fb35840a12b Co-authored-by: Bram Moolenaar --- test/old/testdir/test_functions.vim | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'test/old/testdir/test_functions.vim') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 5981b5214b..ba8134cc2d 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2568,6 +2568,17 @@ endfunc func Test_state() CheckRunVimInTerminal + " In the first run try a short wait time. If the test fails retry with a + " longer wait time. + if g:run_nr == 1 + let wait_time = 50 + elseif g:run_nr == 2 + let wait_time = 200 + else + let wait_time = 500 + endif + let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\" + let lines =<< trim END call setline(1, ['one', 'two', 'three']) map ;; gg @@ -2587,28 +2598,27 @@ func Test_state() " Using a timer callback call term_sendkeys(buf, ":call RunTimer()\") - call term_wait(buf, 50) - let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\" + call term_wait(buf, wait_time) call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000) " Halfway a mapping call term_sendkeys(buf, ":call RunTimer()\;") - call term_wait(buf, 50) + call term_wait(buf, wait_time) call term_sendkeys(buf, ";") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000) " Insert mode completion (bit slower on Mac) call term_sendkeys(buf, ":call RunTimer()\Got\") - call term_wait(buf, 200) + call term_wait(buf, wait_time) call term_sendkeys(buf, "\") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000) " Autocommand executing call term_sendkeys(buf, ":set filetype=foobar\") - call term_wait(buf, 50) + call term_wait(buf, wait_time) call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000) @@ -2616,7 +2626,7 @@ func Test_state() " messages scrolled call term_sendkeys(buf, ":call RunTimer()\:echo \"one\\ntwo\\nthree\"\") - call term_wait(buf, 50) + call term_wait(buf, wait_time) call term_sendkeys(buf, "\") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000) -- cgit From ff801ce7f728ea51cec3328328ac41d98d545725 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 21 Aug 2023 14:59:52 +0800 Subject: vim-patch:8.2.0533: tests using term_wait() can still be flaky Problem: Tests using term_wait() can still be flaky. Solution: Increase the wait time when rerunning a test. (James McCoy, closes vim/vim#5899) Halve the initial times to make tests run faster when there is no rerun. https://github.com/vim/vim/commit/6a2c5a7dd5c9215cc030d5ea6e4616d782c091dd Co-authored-by: Bram Moolenaar --- test/old/testdir/test_functions.vim | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'test/old/testdir/test_functions.vim') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index ba8134cc2d..95c132a5c0 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2568,15 +2568,6 @@ endfunc func Test_state() CheckRunVimInTerminal - " In the first run try a short wait time. If the test fails retry with a - " longer wait time. - if g:run_nr == 1 - let wait_time = 50 - elseif g:run_nr == 2 - let wait_time = 200 - else - let wait_time = 500 - endif let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\" let lines =<< trim END @@ -2598,27 +2589,27 @@ func Test_state() " Using a timer callback call term_sendkeys(buf, ":call RunTimer()\") - call term_wait(buf, wait_time) + call TermWait(buf, 25) call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: c; mode: n', term_getline(buf, 6))}, 1000) " Halfway a mapping call term_sendkeys(buf, ":call RunTimer()\;") - call term_wait(buf, wait_time) + call TermWait(buf, 25) call term_sendkeys(buf, ";") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: mSc; mode: n', term_getline(buf, 6))}, 1000) " Insert mode completion (bit slower on Mac) call term_sendkeys(buf, ":call RunTimer()\Got\") - call term_wait(buf, wait_time) + call TermWait(buf, 25) call term_sendkeys(buf, "\") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: aSc; mode: i', term_getline(buf, 6))}, 1000) " Autocommand executing call term_sendkeys(buf, ":set filetype=foobar\") - call term_wait(buf, wait_time) + call TermWait(buf, 25) call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: xS; mode: n', term_getline(buf, 6))}, 1000) @@ -2626,7 +2617,7 @@ func Test_state() " messages scrolled call term_sendkeys(buf, ":call RunTimer()\:echo \"one\\ntwo\\nthree\"\") - call term_wait(buf, wait_time) + call TermWait(buf, 25) call term_sendkeys(buf, "\") call term_sendkeys(buf, getstate) call WaitForAssert({-> assert_match('state: Scs; mode: r', term_getline(buf, 6))}, 1000) -- cgit From 00f92f086e9e4b47e7067b8247881491468eb893 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 21 Aug 2023 15:30:20 +0800 Subject: vim-patch:8.2.3518: Test_xrestore sometimes fails Problem: Test_xrestore sometimes fails. Solution: Mark the test as flayky. Move marking test as flaky to the test instead of listing them in runtest. https://github.com/vim/vim/commit/f08b0eb8691ff09f98bc4beef986ece1c521655f Co-authored-by: Bram Moolenaar --- test/old/testdir/test_functions.vim | 1 + 1 file changed, 1 insertion(+) (limited to 'test/old/testdir/test_functions.vim') diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 95c132a5c0..1d713e91ce 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2567,6 +2567,7 @@ endfunc func Test_state() CheckRunVimInTerminal + let g:test_is_flaky = 1 let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\" -- cgit