Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
@ 2016-12-02 17:06 Luis Machado
  2016-12-02 17:30 ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2016-12-02 17:06 UTC (permalink / raw)
  To: gdb-patches, palves

This gets rid of more useless pattern matching cases in gdb.base/maint.exp. It
is a follow-on to the previous patch that only removed the timeouts.

Regression-checked by running gdb.base/maint.exp.

gdb/testsuite/ChangeLog:

2016-12-02  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/maint.exp: Remove gdb_prompt and timeout handling in
	gdb_test_multiple calls.
	Use gdb_test instead of gdb_test_multiple when possible.
---
 gdb/testsuite/gdb.base/maint.exp | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 17c606b..9d08ff1 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -71,7 +71,7 @@ gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
 gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
 gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
     "mt expand-symtabs" {
-	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
+	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*" {
 	    # This should expand at most two primary symtabs.
 	    # "Normally" it will not expand any, because the symtab
 	    # holding "main" will already have been expanded, but if the
@@ -93,7 +93,7 @@ if ![runto_main] then {
 # If we're using .gdb_index there will be no psymtabs.
 set have_gdb_index 0
 gdb_test_multiple "maint info sections .gdb_index" "check for .gdb_index" {
-    -re ": .gdb_index.*$gdb_prompt $" {
+    -re ": .gdb_index.*" {
 	set have_gdb_index 1
     }
     -re ".*$gdb_prompt $" {
@@ -287,29 +287,18 @@ gdb_test "cd [standard_output_file {}]" \
     "cd to objdir"
 
 gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" {
-    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
+    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n" {
     	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
 	    -re "msymbols_output2\r\n$gdb_prompt $" {
-	    	gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
-		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
-		    	pass "maint print msymbols"
-		    }
-		    -re ".*$gdb_prompt $" {
-		        fail "maint print msymbols"
-		    }
-		}
-		gdb_test "shell rm -f msymbols_output2" ".*" \
-		    "shell rm -f msymbols_output2"
-	    }
-	    -re ".*$gdb_prompt $" {
-		fail "maint print msymbols"
+		gdb_test "shell grep factorial msymbols_output2" \
+		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
+		    "maint print msymbols"
+		gdb_test "shell rm -f msymbols_output2" ".*"
 	    }
 	}
     }
-    -re ".*$gdb_prompt $" {
-	fail "maint print msymbols"
-    }
 }
+
 gdb_test "cd ${mydir}" \
     "Working directory [string_to_regexp ${mydir}]\..*" \
     "cd to mydir"
-- 
2.7.4


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

* Re: [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 17:06 [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp Luis Machado
@ 2016-12-02 17:30 ` Pedro Alves
  2016-12-02 17:41   ` Luis Machado
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2016-12-02 17:30 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 12/02/2016 05:05 PM, Luis Machado wrote:
> This gets rid of more useless pattern matching cases in gdb.base/maint.exp. It
> is a follow-on to the previous patch that only removed the timeouts.
> 
> Regression-checked by running gdb.base/maint.exp.
> 
> gdb/testsuite/ChangeLog:
> 
> 2016-12-02  Luis Machado  <lgustavo@codesourcery.com>
> 
> 	* gdb.base/maint.exp: Remove gdb_prompt and timeout handling in
> 	gdb_test_multiple calls.
> 	Use gdb_test instead of gdb_test_multiple when possible.
> ---
>  gdb/testsuite/gdb.base/maint.exp | 27 ++++++++-------------------
>  1 file changed, 8 insertions(+), 19 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
> index 17c606b..9d08ff1 100644
> --- a/gdb/testsuite/gdb.base/maint.exp
> +++ b/gdb/testsuite/gdb.base/maint.exp
> @@ -71,7 +71,7 @@ gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
>  gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
>  gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
>      "mt expand-symtabs" {
> -	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
> +	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*" {

Why are you removing this ...

>  	    # This should expand at most two primary symtabs.
>  	    # "Normally" it will not expand any, because the symtab
>  	    # holding "main" will already have been expanded, but if the
> @@ -93,7 +93,7 @@ if ![runto_main] then {
>  # If we're using .gdb_index there will be no psymtabs.
>  set have_gdb_index 0
>  gdb_test_multiple "maint info sections .gdb_index" "check for .gdb_index" {
> -    -re ": .gdb_index.*$gdb_prompt $" {
> +    -re ": .gdb_index.*" {
>  	set have_gdb_index 1
>      }

... and this ...

>      -re ".*$gdb_prompt $" {
> @@ -287,29 +287,18 @@ gdb_test "cd [standard_output_file {}]" \
>      "cd to objdir"
>  
>  gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" {
> -    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
> +    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n" {

... and this?

>      	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
>  	    -re "msymbols_output2\r\n$gdb_prompt $" {
> -	    	gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
> -		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
> -		    	pass "maint print msymbols"
> -		    }
> -		    -re ".*$gdb_prompt $" {
> -		        fail "maint print msymbols"
> -		    }
> -		}
> -		gdb_test "shell rm -f msymbols_output2" ".*" \
> -		    "shell rm -f msymbols_output2"
> -	    }
> -	    -re ".*$gdb_prompt $" {
> -		fail "maint print msymbols"
> +		gdb_test "shell grep factorial msymbols_output2" \
> +		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
> +		    "maint print msymbols"
> +		gdb_test "shell rm -f msymbols_output2" ".*"
>  	    }
>  	}
>      }
> -    -re ".*$gdb_prompt $" {
> -	fail "maint print msymbols"
> -    }
>  }
> +
>  gdb_test "cd ${mydir}" \
>      "Working directory [string_to_regexp ${mydir}]\..*" \
>      "cd to mydir"
> 

This part looks OK.

Thanks,
Pedro Alves


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

* Re: [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 17:30 ` Pedro Alves
@ 2016-12-02 17:41   ` Luis Machado
  2016-12-02 17:48     ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2016-12-02 17:41 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 12/02/2016 11:30 AM, Pedro Alves wrote:
> On 12/02/2016 05:05 PM, Luis Machado wrote:
>> This gets rid of more useless pattern matching cases in gdb.base/maint.exp. It
>> is a follow-on to the previous patch that only removed the timeouts.
>>
>> Regression-checked by running gdb.base/maint.exp.
>>
>> gdb/testsuite/ChangeLog:
>>
>> 2016-12-02  Luis Machado  <lgustavo@codesourcery.com>
>>
>> 	* gdb.base/maint.exp: Remove gdb_prompt and timeout handling in
>> 	gdb_test_multiple calls.
>> 	Use gdb_test instead of gdb_test_multiple when possible.
>> ---
>>  gdb/testsuite/gdb.base/maint.exp | 27 ++++++++-------------------
>>  1 file changed, 8 insertions(+), 19 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
>> index 17c606b..9d08ff1 100644
>> --- a/gdb/testsuite/gdb.base/maint.exp
>> +++ b/gdb/testsuite/gdb.base/maint.exp
>> @@ -71,7 +71,7 @@ gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
>>  gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
>>  gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
>>      "mt expand-symtabs" {
>> -	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
>> +	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*" {
>
> Why are you removing this ...
>

Doesn't gdb_test_multiple already check for a trailing $gdb_prompt?

>>  	    # This should expand at most two primary symtabs.
>>  	    # "Normally" it will not expand any, because the symtab
>>  	    # holding "main" will already have been expanded, but if the
>> @@ -93,7 +93,7 @@ if ![runto_main] then {
>>  # If we're using .gdb_index there will be no psymtabs.
>>  set have_gdb_index 0
>>  gdb_test_multiple "maint info sections .gdb_index" "check for .gdb_index" {
>> -    -re ": .gdb_index.*$gdb_prompt $" {
>> +    -re ": .gdb_index.*" {
>>  	set have_gdb_index 1
>>      }
>
> ... and this ...
>
>>      -re ".*$gdb_prompt $" {
>> @@ -287,29 +287,18 @@ gdb_test "cd [standard_output_file {}]" \
>>      "cd to objdir"
>>
>>  gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint print msymbols" {
>> -    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
>> +    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n" {
>
> ... and this?
>
>>      	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
>>  	    -re "msymbols_output2\r\n$gdb_prompt $" {
>> -	    	gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
>> -		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
>> -		    	pass "maint print msymbols"
>> -		    }
>> -		    -re ".*$gdb_prompt $" {
>> -		        fail "maint print msymbols"
>> -		    }
>> -		}
>> -		gdb_test "shell rm -f msymbols_output2" ".*" \
>> -		    "shell rm -f msymbols_output2"
>> -	    }
>> -	    -re ".*$gdb_prompt $" {
>> -		fail "maint print msymbols"
>> +		gdb_test "shell grep factorial msymbols_output2" \
>> +		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
>> +		    "maint print msymbols"
>> +		gdb_test "shell rm -f msymbols_output2" ".*"
>>  	    }
>>  	}
>>      }
>> -    -re ".*$gdb_prompt $" {
>> -	fail "maint print msymbols"
>> -    }
>>  }
>> +
>>  gdb_test "cd ${mydir}" \
>>      "Working directory [string_to_regexp ${mydir}]\..*" \
>>      "cd to mydir"
>>
>
> This part looks OK.
>
> Thanks,
> Pedro Alves
>
>


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

* Re: [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 17:41   ` Luis Machado
@ 2016-12-02 17:48     ` Pedro Alves
  2016-12-02 19:02       ` [PATCH] [v2] " Luis Machado
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2016-12-02 17:48 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 12/02/2016 05:40 PM, Luis Machado wrote:

> Doesn't gdb_test_multiple already check for a trailing $gdb_prompt?

gdb_test does, but gdb_test_multiple does not.

What gdb_test_multiple has, is an internal pattern that
matches the prompt if no other user-specified pattern
matches:

	-re "\r\n$gdb_prompt $" {
	    if ![string match "" $message] then {
		fail "$message"
	    }
	    set result 1
	}

That's why the second regexp here:

   gdb_test_multiple "...." "...." {
      -re "some pattern $gdb_prompt $ {
      }
      -re ".*$gdb_prompt $ {
         fail "...."
      }
   }

... is unnecessary.

But the gdb_prompt match in the first regexp is absolutely
necessary, otherwise you leave it dangling in the expect
buffer and confuse whatever comes after.  Whether that
causes trouble or not in a given dejagnu invocation is racy,
depends on how much expect pulls in to its internal buffer
at a time.  Often, "make check-read1" will make such problems
more reproducible.  But just don't introduce the problem in
the first place, please.  :-)

Thanks,
Pedro Alves


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

* [PATCH] [v2] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 17:48     ` Pedro Alves
@ 2016-12-02 19:02       ` Luis Machado
  2016-12-02 19:10         ` Pedro Alves
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2016-12-02 19:02 UTC (permalink / raw)
  To: gdb-patches, palves

Thanks for clarifying the gdb_prompt situation. Updated patch attached.

Btw, check-read1 did catch the problem with a couple failures. I didn't know
about that one.

--

This gets rid of more useless pattern matching cases in gdb.base/maint.exp.

gdb/testsuite/ChangeLog:

2016-12-02  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.base/maint.exp: Use gdb_test instead of gdb_test_multiple when
	possible.
	Remove useless pattern-matching code.
---
 gdb/testsuite/gdb.base/maint.exp | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 17c606b..c66c9ed 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -290,25 +290,13 @@ gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint pri
     -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
     	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
 	    -re "msymbols_output2\r\n$gdb_prompt $" {
-	    	gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
-		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
-		    	pass "maint print msymbols"
-		    }
-		    -re ".*$gdb_prompt $" {
-		        fail "maint print msymbols"
-		    }
-		}
-		gdb_test "shell rm -f msymbols_output2" ".*" \
-		    "shell rm -f msymbols_output2"
-	    }
-	    -re ".*$gdb_prompt $" {
-		fail "maint print msymbols"
+		gdb_test "shell grep factorial msymbols_output2" \
+		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
+		    "maint print msymbols"
+		gdb_test "shell rm -f msymbols_output2" ".*"
 	    }
 	}
     }
-    -re ".*$gdb_prompt $" {
-	fail "maint print msymbols"
-    }
 }
 gdb_test "cd ${mydir}" \
     "Working directory [string_to_regexp ${mydir}]\..*" \
-- 
2.7.4


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

* Re: [PATCH] [v2] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 19:02       ` [PATCH] [v2] " Luis Machado
@ 2016-12-02 19:10         ` Pedro Alves
  2016-12-02 19:37           ` Luis Machado
  0 siblings, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2016-12-02 19:10 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 12/02/2016 07:02 PM, Luis Machado wrote:
> Thanks for clarifying the gdb_prompt situation. Updated patch attached.
> 
> Btw, check-read1 did catch the problem with a couple failures. I didn't know
> about that one.

There's more about it in gdb/testsuite/README.

> This gets rid of more useless pattern matching cases in gdb.base/maint.exp.
> 
> gdb/testsuite/ChangeLog:
> 
> 2016-12-02  Luis Machado  <lgustavo@codesourcery.com>
> 
> 	* gdb.base/maint.exp: Use gdb_test instead of gdb_test_multiple when
> 	possible.
> 	Remove useless pattern-matching code.

OK.

Thanks,
Pedro Alves


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

* Re: [PATCH] [v2] Remove unneeded pattern matching in gdb.base/maint.exp
  2016-12-02 19:10         ` Pedro Alves
@ 2016-12-02 19:37           ` Luis Machado
  0 siblings, 0 replies; 7+ messages in thread
From: Luis Machado @ 2016-12-02 19:37 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 12/02/2016 01:10 PM, Pedro Alves wrote:
> On 12/02/2016 07:02 PM, Luis Machado wrote:
>> Thanks for clarifying the gdb_prompt situation. Updated patch attached.
>>
>> Btw, check-read1 did catch the problem with a couple failures. I didn't know
>> about that one.
>
> There's more about it in gdb/testsuite/README.
>
>> This gets rid of more useless pattern matching cases in gdb.base/maint.exp.
>>
>> gdb/testsuite/ChangeLog:
>>
>> 2016-12-02  Luis Machado  <lgustavo@codesourcery.com>
>>
>> 	* gdb.base/maint.exp: Use gdb_test instead of gdb_test_multiple when
>> 	possible.
>> 	Remove useless pattern-matching code.
>
> OK.
>
> Thanks,
> Pedro Alves
>

Thanks. Pushed now.


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

end of thread, other threads:[~2016-12-02 19:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 17:06 [PATCH] Remove unneeded pattern matching in gdb.base/maint.exp Luis Machado
2016-12-02 17:30 ` Pedro Alves
2016-12-02 17:41   ` Luis Machado
2016-12-02 17:48     ` Pedro Alves
2016-12-02 19:02       ` [PATCH] [v2] " Luis Machado
2016-12-02 19:10         ` Pedro Alves
2016-12-02 19:37           ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox