Skip to content

Commit

Permalink
patch 8.0.1163: popup test is flaky
Browse files Browse the repository at this point in the history
Problem:    Popup test is flaky.
Solution:   Add a WaitFor() and fix another.
  • Loading branch information
brammool committed Sep 30, 2017
1 parent 660b85e commit c79977a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/testdir/test_popup.vim
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -761,6 +761,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1163,
/**/
1162,
/**/
Expand Down

4 comments on commit c79977a

@ichizok
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

@brammool brammool commented on c79977a Sep 30, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ichizok
Copy link
Contributor

@ichizok ichizok commented on c79977a Oct 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

@brammool brammool commented on c79977a Oct 1, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.