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: [committed][gdb/testsuite] Fix info-types-c.exp
Date: Mon, 7 Jun 2021 14:34:13 +0200	[thread overview]
Message-ID: <20210607123412.GA8452@delia.home> (raw)

Hi,

Recently, I've rewritten gdb.base/info-types.exp.tcl to do processing
line-by-line (commit 2129a942553).

When building gdb with -O0, this test passes for me, but with -O2 I sometimes
run into:
...
FAIL: gdb.base/info-types-c.exp: info types (state == 1)
...

The output the failing gdb_test_multiple is trying to parse is:
...
(gdb) info types^M
All defined types:^M
^M
File src/gdb/testsuite/gdb.base/info-types.c:^M
52:     typedef enum {...} anon_enum_t;^M
  ...
(gdb)
...
and the FAIL with state == 1 means that:
- the regexp for "All defined types:" did trigger, and that
- the regexp for "File .*info-types.c" didn't trigger.

This is due to the fact that the empty line inbetween is supposed to be
matched by the "random line" regexp "^\r\n(\[^\r\n\]*)(?=\r\n)", which doesn't
happen because instead the earlier regexp consuming the gdb prompt matches.

Fix this by moving the "random line" regexp up.  [ Note that that regexp does
not consume the gdb prompt, because it requires (but doesn't consume) a
terminating "\r\n".

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix info-types-c.exp

gdb/testsuite/ChangeLog:

2021-06-07  Tom de Vries  <tdevries@suse.de>

	* gdb.base/info-types.exp.tcl (run_test): Move "random line" regexp
	up.

---
 gdb/testsuite/gdb.base/info-types.exp.tcl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
index 2989751eef9..0eac3dbe67c 100644
--- a/gdb/testsuite/gdb.base/info-types.exp.tcl
+++ b/gdb/testsuite/gdb.base/info-types.exp.tcl
@@ -168,13 +168,6 @@ proc run_test { lang } {
 	    if { $state == 2 } { set state -4 }
 	    exp_continue
 	}
-	-re -wrap "" {
-	    if { $state == 3} {
-		pass $gdb_test_name
-	    } else {
-		fail "$gdb_test_name (state == $state)"
-	    }
-	}
 	-re "^\r\n(\[^\r\n\]*)(?=\r\n)" {
 	    if { $state == 2 } {
 		set line $expect_out(1,string)
@@ -187,6 +180,13 @@ proc run_test { lang } {
 	    }
 	    exp_continue
 	}
+	-re -wrap "" {
+	    if { $state == 3} {
+		pass $gdb_test_name
+	    } else {
+		fail "$gdb_test_name (state == $state)"
+	    }
+	}
     }
 }
 

                 reply	other threads:[~2021-06-07 12:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210607123412.GA8452@delia.home \
    --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