]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Improve gdb.tui/pr30056.exp
authorTom de Vries <tdevries@suse.de>
Fri, 26 Sep 2025 23:13:16 +0000 (01:13 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 26 Sep 2025 23:13:16 +0000 (01:13 +0200)
Fix a few things I noticed while working on test-case gdb.tui/pr30056.exp:
- unnecessary indentation due to save_vars
- missing gdb_assert checking the result of Term::wait_for_region_contents
- redundant comment "Uncomment this to simulate that PR cli/30498 is fixed"

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.tui/pr30056.exp

index 742115c918aba412632769fdce91f30680a6a288..3cf5e906b7a026ed6f8fa4d3e19aa962946c8545 100644 (file)
@@ -33,60 +33,61 @@ save_vars { env(LC_ALL) } {
 
     # Start terminal.
     Term::clean_restart 24 80 $testfile
+}
 
-    # Start TUI.
-    if {![Term::enter_tui]} {
-       unsupported "TUI not supported"
-       return
-    }
-
-    # Send "^R", starting reverse-i-search.
-    send_gdb "\022"
-    Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
-       [string_to_regexp "(reverse-i-search)`': "]
-
-    # Send "xyz".
-    send_gdb "xyz"
-    Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
-       [string_to_regexp "(failed reverse-i-search)`xyz': "]
-
-    # Send arrow-right.
-    send_gdb "\033\[C"
-    # Wait for arrow-right effect.
-    gdb_assert { [Term::wait_for_region_contents 1 5 78 1 \
-                     [string_to_regexp " ain (void)"]] } "arrow right"
-
-    # Send ^C.
-    send_gdb "\003"
-    gdb_assert { [Term::wait_for "Quit"] } "Control-C"
-
-    # Uncomment this to simulate that PR cli/30498 is fixed.
-    #send_gdb "\007"
-
-    set test "Control-C aborts isearch"
-
-    # Send "xyz", again.
-    send_gdb "xyz"
-    # Wait for xyx to appear.
-    Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 "xyz"
-
-    if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \
-             "^$gdb_prompt xyz"] } {
-       pass $test
-
-       # Send ^C to clear the command line.
-       send_gdb "\003"
-    } else {
-       # Sending ^C currently doesn't abort the i-search.
-       fail $test
+# Start TUI.
+if {![Term::enter_tui]} {
+    unsupported "TUI not supported"
+    return
+}
 
-       # At this point we don't have a responsive prompt.  Send ^G to abort
-       # the i-search.
-       send_gdb "\007"
-    }
+# Send "^R", starting reverse-i-search.
+send_gdb "\022"
+gdb_assert { [Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
+                 [string_to_regexp "(reverse-i-search)`': "]] } \
+    "reverse-i-search"
+
+# Send "xyz".
+send_gdb "xyz"
+gdb_assert { [Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \
+                 [string_to_regexp "(failed reverse-i-search)`xyz': "]] } \
+    "xyz"
+
+# Send arrow-right.
+send_gdb "\033\[C"
+# Wait for arrow-right effect.
+gdb_assert { [Term::wait_for_region_contents 1 5 78 1 \
+                 [string_to_regexp " ain (void)"]] } "arrow right"
+
+# Send ^C.
+send_gdb "\003"
+gdb_assert { [Term::wait_for "Quit"] } "Control-C"
+
+set test "Control-C aborts isearch"
+
+# Send "xyz", again.
+send_gdb "xyz"
+# Wait for xyx to appear.
+gdb_assert { [Term::wait_for_region_contents \
+                 0 $Term::_cur_row $Term::_cols 1 "xyz"] } \
+    "xyz, again"
+
+if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \
+         "^$gdb_prompt xyz"] } {
+    pass $test
+
+    # Send ^C to clear the command line.
+    send_gdb "\003"
+} else {
+    # Sending ^C currently doesn't abort the i-search.
+    fail $test
 
-    # We need a responsive prompt here, to deal with the "monitor exit"
-    # that native-extended-gdbserver will send.  Check that we have a
-    # responsive prompt.
-    Term::command "echo \\n"
+    # At this point we don't have a responsive prompt.  Send ^G to abort
+    # the i-search.
+    send_gdb "\007"
 }
+
+# We need a responsive prompt here, to deal with the "monitor exit"
+# that native-extended-gdbserver will send.  Check that we have a
+# responsive prompt.
+Term::command "echo \\n"