Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Reset errcnt in clean_restart
Date: Fri, 24 Apr 2020 12:38:58 +0200	[thread overview]
Message-ID: <20200424103857.GA6028@delia> (raw)

Hi,

When running test-case gdb.base/readnever.exp without commit 96038148d0e
"[gdb/testsuite] Skip gdb.base/readnever.exp with target board readnow", we
run into an error:
...
ERROR: (eof) GDB never initialized.
testcase gdb/testsuite/gdb.base/readnever.exp completed in 0 seconds
...

If we additionally run test-case gdb.base/realname-expand.exp, we get an
unresolved for the first test:
...
UNRESOLVED: gdb.base/realname-expand.exp: set basenames-may-differ on
...

Using -v we find out that the UNRESOLVED is due the error triggered in the
previous test-case:
...
(gdb) set basenames-may-differ on^M
(gdb) Error/Warning threshold exceeded:  1 0 (max. 1 3)
UNRESOLVED: gdb.base/realname-expand.exp: set basenames-may-differ on
...

So, the error count of one test spills into the next test, even though we do a
clean restart.  That seems like a bad idea.

Fix this by resetting errcnt (as well as warncnt) in clean_restart, such that
we have:
...
Running src/gdb/testsuite/gdb.base/readnever.exp ...
ERROR: (eof) GDB never initialized.
Running src/gdb/testsuite/gdb.base/realname-expand.exp ...
PASS: gdb.base/realname-expand.exp: set basenames-may-differ on
...

Tested on x86_64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Reset errcnt in clean_restart

gdb/testsuite/ChangeLog:

2020-04-24  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (clean_restart): Reset errcnt and warncnt.

---
 gdb/testsuite/lib/gdb.exp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index cdf96e3c703..2208f3a1a9b 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6108,6 +6108,7 @@ proc clean_restart { args } {
     global srcdir
     global subdir
     global errcnt
+    global warncnt
 
     if { [llength $args] > 1 } {
 	error "bad number of args: [llength $args]"
@@ -6115,15 +6116,18 @@ proc clean_restart { args } {
 
     gdb_exit
 
+    # This is a clean restart, so reset error and warning count.
+    set errcnt 0
+    set warncnt 0
+
     # We'd like to do:
     #   if { [gdb_start] == -1 } {
     #     return -1
     #   }
     # but gdb_start is a ${tool}_start proc, which doesn't have a defined
     # return value.  So instead, we test for errcnt.
-    set saved_errcnt $errcnt
     gdb_start
-    if { $errcnt > $saved_errcnt } {
+    if { $errcnt > 0 } {
 	return -1
     }
 


             reply	other threads:[~2020-04-24 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 10:38 Tom de Vries [this message]
2020-04-24 14:11 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200424103857.GA6028@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox