Permalink
Browse files

patch 8.0.1163: popup test is flaky

Problem:    Popup test is flaky.
Solution:   Add a WaitFor() and fix another.
  • Loading branch information...
brammool committed Sep 30, 2017
1 parent 660b85e commit c79977a437d91306d576fb59e490601409503303
Showing with 5 additions and 2 deletions.
  1. +3 −2 src/testdir/test_popup.vim
  2. +2 −0 src/version.c
@@ -649,14 +649,15 @@ func Test_popup_and_window_resize()
call term_wait(g:buf, 100)
call term_sendkeys(g:buf, "\<c-v>")
call term_wait(g:buf, 100)
call WaitFor('term_getline(g:buf, 1) =~ "^!"')
call assert_match('^!\s*$', term_getline(g:buf, 1))
exe 'resize +' . (h - 1)
call term_wait(g:buf, 100)
redraw!
call WaitFor('"" == term_getline(g:buf, 1)')
call WaitFor('term_getline(g:buf, 1) == ""')
call assert_equal('', term_getline(g:buf, 1))
sleep 100m
call WaitFor('"^!" =~ term_getline(g:buf, term_getcursor(g:buf)[0] + 1)')
call WaitFor('term_getline(g:buf, term_getcursor(g:buf)[0] + 1) =~ "^!"')
call assert_match('^!\s*$', term_getline(g:buf, term_getcursor(g:buf)[0] + 1))
bwipe!
endfunc
View
@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1163,
/**/
1162,
/**/

4 comments on commit c79977a

@ichizok

This comment has been minimized.

Show comment
Hide comment
@ichizok

ichizok Sep 30, 2017

As far as I confirmed, term_wait after sending o<Ecs>G is need.

Passed: applied the following patch
https://travis-ci.org/ichizok/vim/builds/281518922

Failed: reverted patch (== original test code)
https://travis-ci.org/ichizok/vim/builds/281523967

diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 4ab860b81..7fd290b3a 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -645,6 +645,7 @@ func Test_popup_and_window_resize()
   endif
   let g:buf = term_start([$VIMPROG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
   call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
+  call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "i\<c-x>")
   call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "\<c-v>")

ichizok replied Sep 30, 2017

As far as I confirmed, term_wait after sending o<Ecs>G is need.

Passed: applied the following patch
https://travis-ci.org/ichizok/vim/builds/281518922

Failed: reverted patch (== original test code)
https://travis-ci.org/ichizok/vim/builds/281523967

diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 4ab860b81..7fd290b3a 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -645,6 +645,7 @@ func Test_popup_and_window_resize()
   endif
   let g:buf = term_start([$VIMPROG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
   call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
+  call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "i\<c-x>")
   call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "\<c-v>")
@brammool

This comment has been minimized.

Show comment
Hide comment
@brammool

brammool Sep 30, 2017

Contributor
Contributor

brammool replied Sep 30, 2017

@ichizok

This comment has been minimized.

Show comment
Hide comment
@ichizok

ichizok Oct 1, 2017

I investigated further;
Vim built with ASAN has lesser performance, so in-terminal Vim needs more than 100ms from
term_start to be in the state of selection of ins-completion mode (e.g. waiting the next character of <C-X>).
https://travis-ci.org/ichizok/vim/builds/281881274

Therefore, for example, it is even enough to increate timeout before sending <C-V> as below.
(but "200ms" is also arbitrary...

--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -645,9 +645,8 @@ func Test_popup_and_window_resize()
   endif
   let g:buf = term_start([$VIMPROG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
   call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
-  call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "i\<c-x>")
-  call term_wait(g:buf, 100)
+  call term_wait(g:buf, 200)
   call term_sendkeys(g:buf, "\<c-v>")
   call term_wait(g:buf, 100)
   " popup first entry "!" must be at the top

ichizok replied Oct 1, 2017

I investigated further;
Vim built with ASAN has lesser performance, so in-terminal Vim needs more than 100ms from
term_start to be in the state of selection of ins-completion mode (e.g. waiting the next character of <C-X>).
https://travis-ci.org/ichizok/vim/builds/281881274

Therefore, for example, it is even enough to increate timeout before sending <C-V> as below.
(but "200ms" is also arbitrary...

--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -645,9 +645,8 @@ func Test_popup_and_window_resize()
   endif
   let g:buf = term_start([$VIMPROG, '--clean', '-c', 'set noswapfile'], {'term_rows': h / 3})
   call term_sendkeys(g:buf, (h / 3 - 1)."o\<esc>G")
-  call term_wait(g:buf, 100)
   call term_sendkeys(g:buf, "i\<c-x>")
-  call term_wait(g:buf, 100)
+  call term_wait(g:buf, 200)
   call term_sendkeys(g:buf, "\<c-v>")
   call term_wait(g:buf, 100)
   " popup first entry "!" must be at the top
@brammool

This comment has been minimized.

Show comment
Hide comment
@brammool

brammool Oct 1, 2017

Contributor
Contributor

brammool replied Oct 1, 2017

Please sign in to comment.