[binutils-gdb] [gdb/testsuite] Modernize gdb.base/command-line-input.exp

Tom de Vries vries@sourceware.org
Tue Jul 22 20:26:07 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f89a2a68bed982a583fd66e9516b369a3b550590

commit f89a2a68bed982a583fd66e9516b369a3b550590
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Jul 22 22:26:05 2025 +0200

    [gdb/testsuite] Modernize gdb.base/command-line-input.exp
    
    Modernize test-case gdb.base/command-line-input.exp using clean_restart,
    multi_line and string_to_regexp.
    
    Tested on x86_64-linux.
    
    Approved-By: Andrew Burgess <aburgess@redhat.com>

Diff:
---
 gdb/testsuite/gdb.base/command-line-input.exp | 30 ++++++++++++++++++---------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/gdb/testsuite/gdb.base/command-line-input.exp b/gdb/testsuite/gdb.base/command-line-input.exp
index da559130d61..9760f1a3974 100644
--- a/gdb/testsuite/gdb.base/command-line-input.exp
+++ b/gdb/testsuite/gdb.base/command-line-input.exp
@@ -18,23 +18,33 @@
 # Test issuing a command split in multiple lines with continuation
 # characters.
 
-gdb_exit
-gdb_start
+clean_restart
 
 set bs "\\"
 set re_bs [string_to_regexp $bs]
+set re_dollar [string_to_regexp $]
 
-set test "print 1\\\\n + 2"
-gdb_test_multiple "print 1\\\n + 2" $test {
-    -re "^print 1\\\\\r\n \\+ 2\r\n\\\$$decimal = 3\r\n$gdb_prompt $" {
-	pass $test
+set re \
+    [multi_line \
+	 ^[string_to_regexp "print 1$bs"] \
+	 [string_to_regexp " + 2"] \
+	 "$re_dollar$decimal = 3" \
+	 "$gdb_prompt $"]
+gdb_test_multiple "print 1$bs\n + 2" "print 1$bs${bs}n + 2" {
+    -re $re {
+	pass $gdb_test_name
     }
 }
 
-set test "print 1\\\\n2"
-gdb_test_multiple "print 1\\\n2" $test {
-    -re "^print 1\\\\\r\n2\r\n\\\$$decimal = 12\r\n$gdb_prompt $" {
-	pass $test
+set re \
+    [multi_line \
+	 ^[string_to_regexp "print 1$bs"] \
+	 "2" \
+	 "$re_dollar$decimal = 12" \
+	 "$gdb_prompt $"]
+gdb_test_multiple "print 1$bs\n2" "print 1$bs${bs}n2" {
+    -re $re {
+	pass $gdb_test_name
     }
 }


More information about the Gdb-cvs mailing list