Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Check for valid test name
@ 2021-09-13  7:19 Tom de Vries via Gdb-patches
  2021-09-13 14:26 ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries via Gdb-patches @ 2021-09-13  7:19 UTC (permalink / raw)
  To: gdb-patches

Hi,

When running gdb.base/batch-exit-status.exp I noticed that the test name
contains a newline:
...
PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
: No such file or directory\.: [lindex $result 2] == 0
...

Check for this in ::CheckTestNames::check, such that we have a warning:
...
PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M
: No such file or directory\.: [lindex $result 2] == 0
WARNING: Newline in test name
...

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Check for valid test name

---
 gdb/testsuite/lib/check-test-names.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/lib/check-test-names.exp b/gdb/testsuite/lib/check-test-names.exp
index 1de7624d5c5..db76abab990 100644
--- a/gdb/testsuite/lib/check-test-names.exp
+++ b/gdb/testsuite/lib/check-test-names.exp
@@ -93,6 +93,13 @@ namespace eval ::CheckTestNames {
 	return $message
     }
 
+    # Check if MESSAGE is a well-formed test name.
+    proc _check_name { message } {
+	if { [regexp \n $message]} {
+	    warning "Newline in test name"
+	}
+    }
+
     # Check if MESSAGE contains either the source path or the build path.
     # This will result in test names that can't easily be compared between
     # different runs of GDB.
@@ -110,6 +117,8 @@ namespace eval ::CheckTestNames {
 	if [ _check_duplicates $message ] {
 	    clone_output "DUPLICATE: $message"
 	}
+
+	_check_name $message
     }
 
     # If COUNT is greater than zero, disply PREFIX followed by COUNT.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-13 18:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  7:19 [PATCH][gdb/testsuite] Check for valid test name Tom de Vries via Gdb-patches
2021-09-13 14:26 ` Andrew Burgess
2021-09-13 18:37   ` Tom de Vries via Gdb-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox