Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: [RFC][gdb/testsuite] Handle -line and -non-empty-line in gdb_test_multiple
Date: Wed, 19 Feb 2020 21:30:00 -0000	[thread overview]
Message-ID: <0208e698-e2e1-c13f-486f-caa3f7766d6a@suse.de> (raw)
In-Reply-To: <851a18b0-b172-4b59-e411-ce3379c95c76@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

[ was: Re: [PATCH][gdb/testsuite] Fix corefile-buildid.exp with
check-read1 ]
On 19-02-2020 21:09, Pedro Alves wrote:
> On 2/19/20 5:40 PM, Tom de Vries wrote:
>> Hi,
>>
>> When running gdb.base/corefile-buildid.exp using check-read1, I run into:
>> ...
>> FAIL: gdb.base/corefile-buildid.exp: shared: info files (timeout)
>> FAIL: gdb.base/corefile-buildid.exp: symlink shared: info files (timeout)
>> FAIL: gdb.base/corefile-buildid.exp: shared sepdebug: info files (timeout)
>> FAIL: gdb.base/corefile-buildid.exp: symlink shared sepdebug: info files \
>>   (timeout)
>> ...
>>
>> This is caused by attempting to match the output of an "info files" command
>> using a single gdb_test in check_exec_file.
>>
>> Fix this by doing line-by-line matching in check_exec_file.
>>
>> Tested on x86_64-linux, using make targets check and check-read1.
>>
>> OK for trunk?
> 
> OK.
> 

Committed.

> If this pattern appears in more places it may be worth it to
> think about some abstraction to make it easier to write.
> Like e.g., a new "-lbl" (line-by-line) option switch to
> gdb_test_multiple that auto-appends the "match one line" regexp.

How about this?

Thanks,
- Tom


[-- Attachment #2: 0001-gdb-testsuite-Handle-line-and-non-empty-line-in-gdb_test_multiple.patch --]
[-- Type: text/x-patch, Size: 4641 bytes --]

[gdb/testsuite] Handle -line and -non-empty-line in gdb_test_multiple

Add predefined regexps in gdb_test_multiple:
* -line
  meaning -re "^\[^\r\n\]*\r\n"
* -non-empty-line
  meaning -re "^\[^\r\n\]+\r\n"

Reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-02-19  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (gdb_test_multiple): Handle -line and -non-empty-line.
	* gdb.base/corefile-buildid.exp: Use -line.
	* gdb.base/solib-corrupted.exp: Same.
	* gdb.arch/mips-fpregset-core.exp: Use -non-empty-line.
	* gdb.base/auxv.exp: Same.
	* gdb.base/callfuncs.exp: Same.

---
 gdb/testsuite/gdb.arch/mips-fpregset-core.exp |  2 +-
 gdb/testsuite/gdb.base/auxv.exp               |  2 +-
 gdb/testsuite/gdb.base/callfuncs.exp          |  2 +-
 gdb/testsuite/gdb.base/corefile-buildid.exp   |  6 +++---
 gdb/testsuite/gdb.base/solib-corrupted.exp    |  2 +-
 gdb/testsuite/lib/gdb.exp                     | 19 +++++++++++++++++++
 6 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
index 3a199f8eba..fecc9f00e3 100644
--- a/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
+++ b/gdb/testsuite/gdb.arch/mips-fpregset-core.exp
@@ -55,7 +55,7 @@ proc mips_fpregset_core_fetch_float_registers { test } {
 	-re "$gdb_prompt $" {
 	    incr bad
 	}
-	-re "^\[^\r\n\]+\r\n" {
+	-non-empty-line {
 	    if { !$bad } {
 		warning "Unrecognized output: $expect_out(0,string)"
 		set bad 1
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 9834a3564d..5a54599fc1 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -100,7 +100,7 @@ proc fetch_auxv {test} {
 	-re "$gdb_prompt $" {
 	    incr bad
 	}
-	-re "^\[^\r\n\]+\r\n" {
+	-non-empty-line {
 	    if {!$bad} {
 		warning "Unrecognized output: $expect_out(0,string)"
 		set bad 1
diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp
index 5d98541745..33740922e7 100644
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -302,7 +302,7 @@ proc fetch_all_registers {test} {
 	-re "$gdb_prompt $" {
 	    incr bad
 	}
-	-re "^\[^\r\n\]+\r\n" {
+	-non-empty-line {
 	    if {!$bad} {
 		warning "Unrecognized output: $expect_out(0,string)"
 		set bad 1
diff --git a/gdb/testsuite/gdb.base/corefile-buildid.exp b/gdb/testsuite/gdb.base/corefile-buildid.exp
index b9844ee354..43e44443d5 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid.exp
+++ b/gdb/testsuite/gdb.base/corefile-buildid.exp
@@ -121,7 +121,7 @@ proc check_exec_file {file} {
 	-re "^$gdb_prompt $" {
 	    fail $gdb_test_name
 	}
-	-re "^\[^\r\n\]*\r\n" {
+	-line {
 	    exp_continue
 	}
     }
@@ -139,7 +139,7 @@ proc check_exec_file {file} {
 	-re "^$gdb_prompt $" {
 	    fail $gdb_test_name
 	}
-	-re "^\[^\r\n\]*\r\n" {
+	-line {
 	    exp_continue
 	}
     }
@@ -153,7 +153,7 @@ proc check_exec_file {file} {
 	-re "^$gdb_prompt $" {
 	    pass $gdb_test_name
 	}
-	-re "^\[^\r\n\]*\r\n" {
+	-line {
 	    exp_continue
 	}
     }
diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp
index 5ee943cae1..10adb9a0ba 100644
--- a/gdb/testsuite/gdb.base/solib-corrupted.exp
+++ b/gdb/testsuite/gdb.base/solib-corrupted.exp
@@ -50,7 +50,7 @@ gdb_test_multiple $test $test {
 	}
 	exp_continue
     }
-    -re "^\[^\r\n\]*\r\n" {
+    -line {
 	exp_continue
     }
     -re "^$gdb_prompt $" {
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index d5e2295703..7fd783e786 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -792,6 +792,13 @@ proc gdb_internal_error_resync {} {
 #	}
 #    }
 #
+# In EXPECT_ARGUMENTS, instead of -re "bla" we can use a few predefined
+# regexps:
+# * -line
+#    meaning -re "^\[^\r\n\]*\r\n"
+# * -non-empty-line
+#    meaning -re "^\[^\r\n\]+\r\n"
+#
 proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
     global verbose use_gdb_stub
     global gdb_prompt pagination_prompt
@@ -867,6 +874,18 @@ proc gdb_test_multiple { command message user_code { prompt_regexp "" } } {
 	    lappend $current_list $item
 	    continue
 	}
+	if { $item == "-line" } {
+	    lappend $current_list -re
+	    lappend $current_list "^\[^\r\n\]*\r\n"	
+	    set expecting_action 1
+	    continue
+	}
+	if { $item == "-non-empty-line" } {
+	    lappend $current_list -re
+	    lappend $current_list "^\[^\r\n\]+\r\n"
+	    set expecting_action 1
+	    continue
+	}
 	if { $item == "-early" } {
 	    set current_list "early_processed_code"
 	    continue

  reply	other threads:[~2020-02-19 21:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 17:40 [PATCH][gdb/testsuite] Fix corefile-buildid.exp with check-read1 Tom de Vries
2020-02-19 20:09 ` Pedro Alves
2020-02-19 21:30   ` Tom de Vries [this message]
2020-02-20 13:28     ` [RFC][gdb/testsuite] Handle -line and -non-empty-line in gdb_test_multiple Pedro Alves
2020-02-21 15:35       ` [RFC][gdb/testsuite] Add -lbl option " Tom de Vries
2020-02-27 16:03         ` Pedro Alves
2020-03-01  9:08           ` Tom de Vries
2020-03-02 13:34             ` Pedro Alves

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=0208e698-e2e1-c13f-486f-caa3f7766d6a@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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