[08/24] Make gdb.base/sizeof.exp use gdb_test_stdio

Message ID 1429639711-16459-9-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves April 21, 2015, 6:08 p.m. UTC
  gdb/testsuite/ChangeLog:
2015-04-21  Pedro Alves  <palves@redhat.com>

	* gdb.base/sizeof.exp (check_sizeof, check_valueof): Use
	gdb_test_stdio.
---
 gdb/testsuite/gdb.base/sizeof.exp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
  

Comments

Antoine Tremblay April 23, 2015, 3:36 p.m. UTC | #1
On 04/21/2015 02:08 PM, Pedro Alves wrote:
> gdb/testsuite/ChangeLog:
> 2015-04-21  Pedro Alves  <palves@redhat.com>
>
> 	* gdb.base/sizeof.exp (check_sizeof, check_valueof): Use
> 	gdb_test_stdio.
> ---
>   gdb/testsuite/gdb.base/sizeof.exp | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
> index 7fda76e..a237ee3 100644
> --- a/gdb/testsuite/gdb.base/sizeof.exp
> +++ b/gdb/testsuite/gdb.base/sizeof.exp
> @@ -70,8 +70,10 @@ set sizeof_long_double [get_sizeof "long double" 8]
>   proc check_sizeof { type size } {
>       global gdb_prompt
>
> -    set pat [string_to_regexp "sizeof (${type}) == ${size}"]
> -    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*"  "check sizeof \"$type\""
> +    set pat [string_to_regexp "sizeof (${type}) == ${size}\r\n"]
> +    gdb_test_stdio "next" "${pat}" \
> +	"\[0-9\].*" \
> +	"check sizeof \"$type\""
>   }
>
>   check_sizeof "char" ${sizeof_char}
> @@ -90,8 +92,10 @@ check_sizeof "long double" ${sizeof_long_double}
>   proc check_valueof { exp val } {
>       global gdb_prompt
>
> -    set pat [string_to_regexp "valueof (${exp}) == ${val}"]
> -    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check valueof \"$exp\""
> +    set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"]
> +    gdb_test_stdio "next" "${pat}" \
> +	"\[0-9\].*" \
> +	"check valueof \"$exp\""
>   }
>
>   # Check that GDB and the target agree over the sign of a character.
>

It's not part of the patch but should we replace :

# Test depends on printf, which the sparclet stub doesn't support.
if { [istarget "sparclet-*-*"] } {
     return 0
}

With :if [target_info exists gdb,noinferiorio] { ?

This is present in other tests too...

Thanks,
Antoine


And add that option to the sparclet target ? ( I could not find that 
target in the tree even if config/m32r-stub.exp references it...
  
Antoine Tremblay April 23, 2015, 3:38 p.m. UTC | #2
On 04/23/2015 11:36 AM, Antoine Tremblay wrote:
>
>
> On 04/21/2015 02:08 PM, Pedro Alves wrote:
>> gdb/testsuite/ChangeLog:
>> 2015-04-21  Pedro Alves  <palves@redhat.com>
>>
>>     * gdb.base/sizeof.exp (check_sizeof, check_valueof): Use
>>     gdb_test_stdio.
>> ---
>>   gdb/testsuite/gdb.base/sizeof.exp | 12 ++++++++----
>>   1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.base/sizeof.exp
>> b/gdb/testsuite/gdb.base/sizeof.exp
>> index 7fda76e..a237ee3 100644
>> --- a/gdb/testsuite/gdb.base/sizeof.exp
>> +++ b/gdb/testsuite/gdb.base/sizeof.exp
>> @@ -70,8 +70,10 @@ set sizeof_long_double [get_sizeof "long double" 8]
>>   proc check_sizeof { type size } {
>>       global gdb_prompt
>>
>> -    set pat [string_to_regexp "sizeof (${type}) == ${size}"]
>> -    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*"  "check sizeof \"$type\""
>> +    set pat [string_to_regexp "sizeof (${type}) == ${size}\r\n"]
>> +    gdb_test_stdio "next" "${pat}" \
>> +    "\[0-9\].*" \
>> +    "check sizeof \"$type\""
>>   }
>>
>>   check_sizeof "char" ${sizeof_char}
>> @@ -90,8 +92,10 @@ check_sizeof "long double" ${sizeof_long_double}
>>   proc check_valueof { exp val } {
>>       global gdb_prompt
>>
>> -    set pat [string_to_regexp "valueof (${exp}) == ${val}"]
>> -    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check valueof \"$exp\""
>> +    set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"]
>> +    gdb_test_stdio "next" "${pat}" \
>> +    "\[0-9\].*" \
>> +    "check valueof \"$exp\""
>>   }
>>
>>   # Check that GDB and the target agree over the sign of a character.
>>
>
> It's not part of the patch but should we replace :
>
> # Test depends on printf, which the sparclet stub doesn't support.
> if { [istarget "sparclet-*-*"] } {
>      return 0
> }
>
> With :if [target_info exists gdb,noinferiorio] { ?
>
> This is present in other tests too...
>
> Thanks,
> Antoine
>
>
> And add that option to the sparclet target ? ( I could not find that
> target in the tree even if config/m32r-stub.exp references it...
>

Oops I've hit send by mistake this was meant for [PATCH 09/24] Make 
gdb.base/call-strs.exp use gdb_test_stdio and others like it...

Sorry about that

Antoine
  
Pedro Alves April 23, 2015, 3:49 p.m. UTC | #3
On 04/23/2015 04:38 PM, Antoine Tremblay wrote:

>> It's not part of the patch but should we replace :
>>
>> # Test depends on printf, which the sparclet stub doesn't support.
>> if { [istarget "sparclet-*-*"] } {
>>      return 0
>> }
>>
>> With :if [target_info exists gdb,noinferiorio] { ?
>>

Yes, though...

>> This is present in other tests too...
>>
>> Thanks,
>> Antoine
>>
>>
>> And add that option to the sparclet target ? ( I could not find that
>> target in the tree even if config/m32r-stub.exp references it...

... I had never heard of sparclet before, until I noticed that line too.
I had assumed it was a Sun SPARC cpu variant, and ignored it.

But now I notice that it's something else.  We still have a chapter
about it in the manual:

  https://sourceware.org/gdb/onlinedocs/gdb/Sparclet.html

But, NEWS says the support was removed in gdb 6.1...

* REMOVED configurations and files

...
Tsqware Sparclet                                sparclet-*-*
...


ChangeLog-2003 has:

...
        * sparclet-stub.c, sparclet-rom.c: Delete obsolete file.
...

etc.


So the remaining bits are just waiting for someone to garbage
collect them.


>>
> 
> Oops I've hit send by mistake this was meant for [PATCH 09/24] Make 
> gdb.base/call-strs.exp use gdb_test_stdio and others like it...
> 
> Sorry about that
> 

No worries.  :-)


Thanks,
Pedro Alves
  
Pedro Alves April 23, 2015, 4:04 p.m. UTC | #4
On 04/23/2015 04:49 PM, Pedro Alves wrote:
> On 04/23/2015 04:38 PM, Antoine Tremblay wrote:
> 
>>> It's not part of the patch but should we replace :
>>>
>>> # Test depends on printf, which the sparclet stub doesn't support.
>>> if { [istarget "sparclet-*-*"] } {
>>>      return 0
>>> }
>>>
>>> With :if [target_info exists gdb,noinferiorio] { ?
>>>
> 
> Yes, though...

TBC, the tests in question already check gdb_skip_stdio_test,
so adding a gdb,noinferiorio check would not be necessary.

(But yes to the rest.)

Thanks,
Pedro Alves
  
Antoine Tremblay April 23, 2015, 4:24 p.m. UTC | #5
On 04/23/2015 12:04 PM, Pedro Alves wrote:
> On 04/23/2015 04:49 PM, Pedro Alves wrote:
>> On 04/23/2015 04:38 PM, Antoine Tremblay wrote:
>>
>>>> It's not part of the patch but should we replace :
>>>>
>>>> # Test depends on printf, which the sparclet stub doesn't support.
>>>> if { [istarget "sparclet-*-*"] } {
>>>>       return 0
>>>> }
>>>>
>>>> With :if [target_info exists gdb,noinferiorio] { ?
>>>>
>>
>> Yes, though...
>
> TBC, the tests in question already check gdb_skip_stdio_test,
> so adding a gdb,noinferiorio check would not be necessary.
>

Indeed, the whole test doesn't always need to be skipped..

Thanks!

Antoine
  

Patch

diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 7fda76e..a237ee3 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -70,8 +70,10 @@  set sizeof_long_double [get_sizeof "long double" 8]
 proc check_sizeof { type size } {
     global gdb_prompt
 
-    set pat [string_to_regexp "sizeof (${type}) == ${size}"]
-    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*"  "check sizeof \"$type\""
+    set pat [string_to_regexp "sizeof (${type}) == ${size}\r\n"]
+    gdb_test_stdio "next" "${pat}" \
+	"\[0-9\].*" \
+	"check sizeof \"$type\""
 }
 
 check_sizeof "char" ${sizeof_char}
@@ -90,8 +92,10 @@  check_sizeof "long double" ${sizeof_long_double}
 proc check_valueof { exp val } {
     global gdb_prompt
 
-    set pat [string_to_regexp "valueof (${exp}) == ${val}"]
-    gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check valueof \"$exp\""
+    set pat [string_to_regexp "valueof (${exp}) == ${val}\r\n"]
+    gdb_test_stdio "next" "${pat}" \
+	"\[0-9\].*" \
+	"check valueof \"$exp\""
 }
 
 # Check that GDB and the target agree over the sign of a character.