vim-patch:9.2.0438: tests: test_plugin_termdebug is flaky

Problem:  Test_termdebug_tbreak(), Test_termdebug_basic(), and
          Test_termdebug_toggle_break() use synchronous assert_equal()
          to check breakpoint signs immediately after sending commands
          to gdb.  On slow CI (ASAN, ARM64, macOS) gdb may not have
          processed the response yet, causing the sign to be missing.
Solution: Wrap the three assertions in WaitForAssert() to poll until
          the signs are placed, matching the pattern already used by
          the other assertions in the same tests (Jesse Rosenstock).

closes: vim/vim#20133

20a124a6e0

Co-authored-by: Jesse Rosenstock <jmr@google.com>
Co-authored-by: Gemini
This commit is contained in:
zeertzjq
2026-05-05 10:27:11 +08:00
parent ddee275c69
commit 64249d2f2a

View File

@@ -182,10 +182,10 @@ func Test_termdebug_basic()
Break 9
call Nterm_wait(gdb_buf)
redraw!
call assert_equal([
call WaitForAssert({-> assert_equal([
\ {'lnum': 9, 'id': 1014, 'name': 'debugBreakpoint1.0',
\ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
Run
call Nterm_wait(gdb_buf, 400)
redraw!
@@ -344,12 +344,12 @@ func Test_termdebug_tbreak()
call Nterm_wait(gdb_buf)
redraw!
" both temporary and normal breakpoint signs were displayed...
call assert_equal([
call WaitForAssert({-> assert_equal([
\ {'lnum': temp_bp_line, 'id': 1014, 'name': 'debugBreakpoint1.0',
\ 'priority': 110, 'group': 'TermDebug'},
\ {'lnum': bp_line, 'id': 2014, 'name': 'debugBreakpoint2.0',
\ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
Run
call Nterm_wait(gdb_buf, 400)
@@ -599,10 +599,10 @@ func Test_termdebug_toggle_break()
call Nterm_wait(gdb_buf)
redraw!
call assert_equal([
call WaitForAssert({-> assert_equal([
\ {'lnum': bp_line, 'id': 1014, 'name': 'debugBreakpoint1.0',
\ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
RunOrContinue
call Nterm_wait(gdb_buf, 400)