public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case
@ 2020-06-11 14:35 Tom de Vries
  2020-06-11 15:31 ` Pedro Alves
  0 siblings, 1 reply; 12+ messages in thread
From: Tom de Vries @ 2020-06-11 14:35 UTC (permalink / raw)
  To: gdb-patches

Hi,

Say we add a call to foobar at the end of a test-case, and run the
test-suite.  We'll run into a dejagnu error:
...
ERROR: (DejaGnu) proc "foobar" does not exist.
...
and the test-suite run is aborted.

It's reasonable that the test-case is aborted, but it's not reasonable that
the testsuite run is aborted.

Problems in one test-case should not leak into other test-cases, and they
generally don't.  The exception is the "invalid command name" problem due to
an override of ::unknown in dejagnu's framework.exp.

Fix this by limiting the scope of dejagnu's ::unknown override.

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Don't abort testrun for invalid command in test-case

gdb/testsuite/ChangeLog:

2020-06-11  Tom de Vries  <tdevries@suse.de>

	PR testsuite/26110
	* lib/gdb.exp (::dejagnu_unknown): Rename from ::unknown.
	(unknown): New proc.

---
 gdb/testsuite/lib/gdb.exp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 51f8a05464..e25f2e74f7 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7243,5 +7243,32 @@ proc with_override { name override body } {
     return $result
 }
 
+# Save the unknown proc defined by dejagnu.
+rename ::unknown ::dejagnu_unknown
+
+# Override the unknown proc with a gdb-local version.
+proc unknown { args } {
+    set script [info script]
+
+    set script [file dirname $script]
+    set subdir3 [file tail $script]
+
+    set script [file dirname $script]
+    set subdir2 [file tail $script]
+
+    set script [file dirname $script]
+    set subdir1 [file tail $script]
+
+    if { $subdir1 == "gdb"
+	 && $subdir2 == "testsuite"
+	 && [regexp {^gdb[.]} $subdir3] } {
+	# If we're executing a gdb test-case, skip dejagnu_unknown to prevent
+	# it from exiting and aborting the entire test run.
+	return [uplevel 1 ::tcl_unknown $args]
+    }
+
+    return [uplevel 1 ::dejagnu_unknown $args]
+}
+
 # Always load compatibility stuff.
 load_lib future.exp

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

end of thread, other threads:[~2020-06-18 10:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 14:35 [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case Tom de Vries
2020-06-11 15:31 ` Pedro Alves
2020-06-11 16:25   ` Tom de Vries
2020-06-11 16:56     ` Pedro Alves
2020-06-11 22:55       ` Tom de Vries
2020-06-16 12:47         ` Pedro Alves
2020-06-17 14:14           ` Tom de Vries
2020-06-17 14:19             ` Pedro Alves
2020-06-18 10:16               ` [PATCH][gdb/testsuite] Move code from gdb_init to default_gdb_init Tom de Vries
2020-06-18 10:56                 ` Pedro Alves
2020-06-12  7:47       ` [PATCH][gdb/testsuite] Don't abort testrun for invalid command in test-case Tom de Vries
2020-06-12  8:37       ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).