public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Reset errcnt and warncnt in default_gdb_init
@ 2024-02-27  9:07 Tom de Vries
  2024-02-27 14:07 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-02-27  9:07 UTC (permalink / raw)
  To: gdb-patches

Say we do:
...
$ make check RUNTESTFLAGS="gdb.dap/ada-nested.exp gdb.dap/pause.exp"
...
and add a perror at the end of pause.exp:
...
 dap_shutdown
+
+perror "foo"
...

We run into:
...
UNRESOLVED: gdb.dap/ada-nested.exp: compilation prog.adb
...

This happens because the perror increases the errcnt, which is not reset at
the end of the test-case, and consequently the first pass in the following
test-case is changed into an unresolved.

Version 1.6.3 of dejagnu contains a fix which produces an unresolved at the
end of the test-case, which does reset the errcnt, but this is with version
1.6.1.

Furthermore, we reset the errcnt in clean_restart, but the pass is produced
before, so that doesn't help either.

Fix this by resetting errcnt and warncnt in default_gdb_init.

Tested on x86_64-linux.

PR testsuite/31351
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31351
---
 gdb/testsuite/lib/gdb.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 7357d56f89a..fe4ac7d2719 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6859,6 +6859,15 @@ proc default_gdb_init { test_file_name } {
 	    return [uplevel 1 ::gdb_tcl_unknown $args]
 	}
     }
+
+    # Dejagnu version 1.6.3 and later produce an unresolved at the end of a
+    # testcase if an error triggered, resetting errcnt and warncnt to 0, in
+    # order to avoid errors in one test-case influencing the following
+    # test-case.  Do this manually here, to support older versions.
+    global errcnt
+    global warncnt
+    set errcnt 0
+    set warncnt 0
 }
 
 # Return a path using GDB_PARALLEL.

base-commit: 268391acb9fa956bad24533e2cc0d1459dea1b3d
-- 
2.35.3


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

* Re: [PATCH] [gdb/testsuite] Reset errcnt and warncnt in default_gdb_init
  2024-02-27  9:07 [PATCH] [gdb/testsuite] Reset errcnt and warncnt in default_gdb_init Tom de Vries
@ 2024-02-27 14:07 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-02-27 14:07 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> Version 1.6.3 of dejagnu contains a fix which produces an unresolved at the
Tom> end of the test-case, which does reset the errcnt, but this is with version
Tom> 1.6.1.

Tom> Furthermore, we reset the errcnt in clean_restart, but the pass is produced
Tom> before, so that doesn't help either.

Tom> Fix this by resetting errcnt and warncnt in default_gdb_init.

Seems reasonable to me, thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

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

end of thread, other threads:[~2024-02-27 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27  9:07 [PATCH] [gdb/testsuite] Reset errcnt and warncnt in default_gdb_init Tom de Vries
2024-02-27 14:07 ` Tom Tromey

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).