Conversation
|
I wrote a test, but since it doesn't fail in pre-patch Vim, so I didn't include it in the PR. diff --git a/src/testdir/test_terminal2.vim b/src/testdir/test_terminal2.vim
index 9413905a9..f57cfb91e 100644
--- a/src/testdir/test_terminal2.vim
+++ b/src/testdir/test_terminal2.vim
@@ -289,6 +289,55 @@ func Test_termwinscroll_topline()
set termwinscroll& mouse&
endfunc
+func Test_termwinscroll_topline2()
+ set termwinscroll=100000 mouse=a
+ let norm_winid = win_getid()
+ terminal
+ call assert_equal(2, winnr('$'))
+ let buf = bufnr()
+ let win = winnr()
+ call WaitFor({-> !empty(term_getline(buf, 1))})
+
+ let num1 = &termwinscroll / 1000 * 999
+ call writefile(range(num1), 'Xtext', 'D')
+ if has('win32')
+ call term_sendkeys(buf, "type Xtext\<CR>")
+ else
+ call term_sendkeys(buf, "cat Xtext\<CR>")
+ endif
+ let rows = term_getsize(buf)[0]
+ " On MS-Windows there is an empty line, check both last line and above it.
+ call WaitForAssert({-> assert_match(string(num1 - 1), term_getline(buf, rows - 1) .. term_getline(buf, rows - 2))})
+ call feedkeys("\<C-W>N", 'xt')
+ call feedkeys("i", 'xt')
+
+ let num2 = &termwinscroll / 1000 * 8
+ call writefile(range(num2), 'Xtext', 'D')
+ if has('win32')
+ call term_sendkeys(buf, "timeout /t 2 && type Xtext\<CR>")
+ else
+ call term_sendkeys(buf, "sleep 2; cat Xtext\<CR>")
+ endif
+ let winrow = get(get(filter(getwininfo(), 'v:val.winid == norm_winid'), 0, {}), 'winrow', -1)
+
+ call test_setmouse(winrow, 1)
+ call feedkeys("\<LeftMouse>", "xt")
+ call WaitForAssert({-> assert_notequal(buf, bufnr())})
+
+ " Change the terminal window row size
+ call win_move_statusline(win,1)
+ " Before the fix, E340 and E315 would occur multiple times at this point.
+ let winrow2 = get(get(filter(getwininfo(), 'v:val.winid == norm_winid'), 0, {}), 'winrow', -1)
+ call assert_equal(winrow + 1, winrow2)
+
+ call test_setmouse(1, 1)
+ call feedkeys("\<LeftMouse>", "xt")
+ call WaitForAssert({-> assert_equal(buf, bufnr())})
+
+ exe buf . 'bwipe!'
+ set termwinscroll& mouse&
+endfunc
+
" Resizing the terminal window caused an ml_get error.
" TODO: This does not reproduce the original problem.
" TODO: This test starts timing out in Github CI Gui test, why???? |
|
thanks |
|
I include the test nevertheless |
|
Seems like the test is failing in CI for macOS (and for local machines too). I saw that @chrisbra added some fixes to try to fix macOS failures in 44a2135 (v9.1.1067) but it's still failing in CI and my local machine. Can we revert or turn the test off for now? Example where it's failing: https://github.com/vim/vim/actions/runs/13207075134. If we have ongoing test failures it's quite difficult to get good signal on whether new changes are introducing regressions. Taking a brief look into the test, it seems like the Just to be clear, this is not a CI flakiness issue (since it fails on local machine with 100% certainty). It's a bug in the test I think (unless it's some weird oddity in the terminal implementation). |
|
Looking at this a little more, I think the The reason why the tests is failing is that the |
|
Yes Thanks that is a good idea |
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org>
|
To add a proper API would also be nice, but I don't currently know how to do it. So let me make the terminal-api related adjustements. |
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org>
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org>
|
Right. I tested out your WIP commit @chrisbra and it does fix the issue. However, the test takes a while to finish on my machine (10s). I think if you replace the This still works slower than just a normal Vim running instance running a terminal printing the file out though. If I just do |
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org>
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org> wait longer Signed-off-by: Christian Brabandt <cb@256bit.org> don't call terminal api on windows
call a terminal callback function when finished printing, instead of using term_wait(). This causes some timeouts on CI with the macos runners related: vim#16552 Signed-off-by: Christian Brabandt <cb@256bit.org> wait longer Signed-off-by: Christian Brabandt <cb@256bit.org> don't call terminal api on windows
Problem: tests: test_terminwscroll_topline2 unreliable
(Yee Cheng Chin)
Solution: instead of using term_wait() with a specific time, use
terminal-api and to wait until the terminal is finished
call a terminal callback function when finished printing, instead of
using term_wait(), with a defined time, which caused timeouts on CI
with the macos runners
Unfortunately I couldn't figure out how to call the terminal-api on Windows,
so skip the test on Windows. cmd.com echo didn's seem to work and
neither did trying to use python, but perhaps it was just me fighting
with the terminal quoting rules 🤷
related: #16599
related: #16552
Signed-off-by: Christian Brabandt <cb@256bit.org>
Fix: #16024 #16211