This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] testsuite: Error on trailing newlines [Re: [obv] testsuite: gdb.cp/ref-types.exp: Excessive newline]

On Wed, 02 Jun 2010 23:43:50 +0200, Joel Brobecker wrote:
> How about automatically catching those? I wonder what would happen if
> we raised an exception if the command sent by gdb_test ended in a
> newline? Same question about gdb_test_multiple...

It now generates some:
Running ./gdb.cp/ref-types.exp ...
ERROR: tcl error sourcing ./gdb.cp/ref-types.exp.
ERROR: gdb_test_multiple: "print value of UI" used trailing newline
    while executing
"error "gdb_test_multiple: \"$message\" used trailing newline""
    invoked from within
"if [string match "*\[\r\n\]" $command] {

No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
(But in fact the fixed testcases were tested only on x86_64-fedora13-linux-gnu.

OK to check-in?  There may be regressions for testcases not tested on this


2010-06-03  Jan Kratochvil  <>

	* lib/gdb.exp (gdb_test_multiple): Error on trailing newlines.
	* gdb.base/commands.exp (add printf tbreak command): Remove trailing
	* gdb.gdb/complaints.exp (empty non-verbose non-noisy clear)
	(empty verbose non-noisy clear, empty verbose noisy clear)
	(empty non-verbose noisy clear): Likewise.

--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -503,7 +503,7 @@ proc temporary_breakpoint_commands {} {
 	    pass "add silent tbreak command"
-    gdb_test_multiple "printf \"factorial tbreak commands executed\\n\"\n" \
+    gdb_test_multiple "printf \"factorial tbreak commands executed\\n\"" \
 	"add printf tbreak command" {
 	    -re ">$" {
 		pass "add printf tbreak command"
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -207,13 +207,13 @@ proc test_empty_complaint { cmd msg } {
 proc test_empty_complaints { } {
-    test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)\n" \
+    test_empty_complaint "call clear_complaints(&symfile_complaints,0,0)" \
 	    "empty non-verbose non-noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)\n" \
+    test_empty_complaint "call clear_complaints(&symfile_complaints,1,0)" \
 	    "empty verbose non-noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)\n" \
+    test_empty_complaint "call clear_complaints(&symfile_complaints,1,1)" \
 	    "empty verbose noisy clear"
-    test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)\n" \
+    test_empty_complaint "call clear_complaints(&symfile_complaints,0,1)" \
 	    "empty non-verbose noisy clear"
     return 0
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -573,6 +573,10 @@ proc gdb_test_multiple { command message user_code } {
 	set message $command
+    if [string match "*\[\r\n\]" $command] {
+	error "gdb_test_multiple: \"$message\" used trailing newline"
+    }
     # Expect does something very strange when it receives a single braced
     # argument.  It splits it along word separators and performs substitutions.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]