]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.1110: Vim tests are slow and flaky v9.1.1110
authorYee Cheng Chin <ychin.git@gmail.com>
Thu, 13 Feb 2025 19:55:45 +0000 (20:55 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 13 Feb 2025 19:55:45 +0000 (20:55 +0100)
commite70587dbdbb1aba2c3f92490b8f870361d4a4177
tree5e0b0e4e7b8e2a347faa8731ff7b6b20b510b9e1
parent977561a7198b5d31a17b852e332704025c2dbdc8
patch 9.1.1110: Vim tests are slow and flaky

Problem:  Vim tests are slow and flaky at the same time due to reliance
          on timeouts which are unreliable.
Solution: improve Vim test performance and reduce flakiness
          (Yee Cheng Chin)

A lot of Vim tests currently rely on waiting a specific amount of time
before asserting a condition. This is bad because 1) it is slow, as the
timeout is hardcoded, 2) it's unreliable as a resource-starved runner
may overshoot the timeout. Also, there are a lot of builtin sleep
commands in commonly used utilities like VerifyScreenDump and WaitFor()
which leads to a lot of unnecessary idle time.

Fix these issues by doing the following:
1. Make utilities like VerifyScreenDump and WaitFor use the lowest wait
   time possible (1 ms). This essentially turns it into a spin wait. On
   fast machines, these will finish very quickly. For existing tests
   that had an implicit reliance on the old timeouts (e.g.
   VerifyScreenDump had a 50ms wait before), fix the tests to wait that
   specific amount explicitly.
2. Fix tests that sleep or wait for long amounts of time to instead
   explicitly use a callback mechanism to be notified when a child
   terminal job has finished. This allows the test to only take as much
   time as possible instead of having to hard code an unreliable
   timeout.

With these fixes, tests should 1) completely quickly on fast machines,
and 2) on slow machines they will still run to completion albeit slowly.
Note that previoulsy both were not true. The hardcoded timeouts meant
that on fast machines the tests were mostly idling wasting time, whereas
on slow machines, the timeouts often were not generous enough to allow
them to run to completion.

closes: #16615

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
17 files changed:
runtime/doc/terminal.txt
runtime/doc/various.txt
src/testdir/crash/ex_redraw_crash [deleted file]
src/testdir/runtest.vim
src/testdir/screendump.vim
src/testdir/shared.vim
src/testdir/term_util.vim
src/testdir/test_balloon.vim
src/testdir/test_crash.vim
src/testdir/test_listlbr_utf8.vim
src/testdir/test_tagjump.vim
src/testdir/test_terminal.vim
src/testdir/test_terminal2.vim
src/testdir/test_terminal3.vim
src/testdir/test_timers.vim
src/testdir/test_visual.vim
src/version.c