[06/11] gdb/testsuite: add XFAIL to gdb.cp/ptype-flags.exp when using clang

Message ID 20221004170747.154307-8-blarsen@redhat.com
State Committed
Headers
Series Cleanup gdb.cp tests when running with clang |

Commit Message

Bruno Larsen Oct. 4, 2022, 5:07 p.m. UTC
  When running gdb.cp/ptype-flags.exp using clang, we get an unexpected
failure when printing the type of a class with an internal typedef. This
happens because clang doesn't add accessibility information for typedefs
inside classes (see https://github.com/llvm/llvm-project/issues/57608
for more info). To help with clang testing, an XFAIL was added to this
test.
---
 gdb/testsuite/gdb.cp/ptype-flags.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Andrew Burgess Oct. 26, 2022, 2:08 p.m. UTC | #1
Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:

> When running gdb.cp/ptype-flags.exp using clang, we get an unexpected
> failure when printing the type of a class with an internal typedef. This
> happens because clang doesn't add accessibility information for typedefs
> inside classes (see https://github.com/llvm/llvm-project/issues/57608
> for more info). To help with clang testing, an XFAIL was added to this
> test.
> ---
>  gdb/testsuite/gdb.cp/ptype-flags.exp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
> index f88c83e03ce..e8d3f285803 100644
> --- a/gdb/testsuite/gdb.cp/ptype-flags.exp
> +++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
> @@ -30,11 +30,18 @@ if ![runto_main] then {
>      return
>  }
>  
> +if {[test_compiler_info {clang-*-*}]} {
> +    set using_clang true
> +} else {
> +    set using_clang false
> +}

Missing the language for the test_compiler_info call.  Looks good with
that fixed.

Thanks,
Andrew

> +
>  gdb_test_no_output "set language c++" ""
>  gdb_test_no_output "set width 0" ""
>  
>  proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>  		      {raw 0}} {
> +    global using_clang
>  
>      set contents {
>  	{ base "public Base<T>" }
> @@ -49,6 +56,11 @@ proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>      }
>  
>      if {$show_typedefs} {
> +	# Clang does not add accessibility information for typedefs:
> +	# https://github.com/llvm/llvm-project/issues/57608
> +	if {$using_clang} {
> +	    setup_xfail "clang 57608" *-*-*
> +	}
>  	lappend contents { typedef public "typedef Simple<Simple<T> > Z;" }
>      }
>  
> -- 
> 2.37.3
  
Bruno Larsen Oct. 27, 2022, 1:17 p.m. UTC | #2
On 26/10/2022 16:08, Andrew Burgess wrote:
> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> When running gdb.cp/ptype-flags.exp using clang, we get an unexpected
>> failure when printing the type of a class with an internal typedef. This
>> happens because clang doesn't add accessibility information for typedefs
>> inside classes (see https://github.com/llvm/llvm-project/issues/57608
>> for more info). To help with clang testing, an XFAIL was added to this
>> test.
>> ---
>>   gdb/testsuite/gdb.cp/ptype-flags.exp | 12 ++++++++++++
>>   1 file changed, 12 insertions(+)
>>
>> diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
>> index f88c83e03ce..e8d3f285803 100644
>> --- a/gdb/testsuite/gdb.cp/ptype-flags.exp
>> +++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
>> @@ -30,11 +30,18 @@ if ![runto_main] then {
>>       return
>>   }
>>   
>> +if {[test_compiler_info {clang-*-*}]} {
>> +    set using_clang true
>> +} else {
>> +    set using_clang false
>> +}
> Missing the language for the test_compiler_info call.  Looks good with
> that fixed.
Great! Can I add an Approved-by tag to the patch?

Cheers,
Bruno

> Thanks,
> Andrew
>
>> +
>>   gdb_test_no_output "set language c++" ""
>>   gdb_test_no_output "set width 0" ""
>>   
>>   proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>   		      {raw 0}} {
>> +    global using_clang
>>   
>>       set contents {
>>   	{ base "public Base<T>" }
>> @@ -49,6 +56,11 @@ proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>       }
>>   
>>       if {$show_typedefs} {
>> +	# Clang does not add accessibility information for typedefs:
>> +	# https://github.com/llvm/llvm-project/issues/57608
>> +	if {$using_clang} {
>> +	    setup_xfail "clang 57608" *-*-*
>> +	}
>>   	lappend contents { typedef public "typedef Simple<Simple<T> > Z;" }
>>       }
>>   
>> -- 
>> 2.37.3
  
Andrew Burgess Oct. 28, 2022, 11:38 a.m. UTC | #3
Bruno Larsen <blarsen@redhat.com> writes:

> On 26/10/2022 16:08, Andrew Burgess wrote:
>> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>>> When running gdb.cp/ptype-flags.exp using clang, we get an unexpected
>>> failure when printing the type of a class with an internal typedef. This
>>> happens because clang doesn't add accessibility information for typedefs
>>> inside classes (see https://github.com/llvm/llvm-project/issues/57608
>>> for more info). To help with clang testing, an XFAIL was added to this
>>> test.
>>> ---
>>>   gdb/testsuite/gdb.cp/ptype-flags.exp | 12 ++++++++++++
>>>   1 file changed, 12 insertions(+)
>>>
>>> diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
>>> index f88c83e03ce..e8d3f285803 100644
>>> --- a/gdb/testsuite/gdb.cp/ptype-flags.exp
>>> +++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
>>> @@ -30,11 +30,18 @@ if ![runto_main] then {
>>>       return
>>>   }
>>>   
>>> +if {[test_compiler_info {clang-*-*}]} {
>>> +    set using_clang true
>>> +} else {
>>> +    set using_clang false
>>> +}
>> Missing the language for the test_compiler_info call.  Looks good with
>> that fixed.
> Great! Can I add an Approved-by tag to the patch?

Sure, with that fix made.

Thanks,
Andrew


>
> Cheers,
> Bruno
>
>> Thanks,
>> Andrew
>>
>>> +
>>>   gdb_test_no_output "set language c++" ""
>>>   gdb_test_no_output "set width 0" ""
>>>   
>>>   proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>>   		      {raw 0}} {
>>> +    global using_clang
>>>   
>>>       set contents {
>>>   	{ base "public Base<T>" }
>>> @@ -49,6 +56,11 @@ proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>>       }
>>>   
>>>       if {$show_typedefs} {
>>> +	# Clang does not add accessibility information for typedefs:
>>> +	# https://github.com/llvm/llvm-project/issues/57608
>>> +	if {$using_clang} {
>>> +	    setup_xfail "clang 57608" *-*-*
>>> +	}
>>>   	lappend contents { typedef public "typedef Simple<Simple<T> > Z;" }
>>>       }
>>>   
>>> -- 
>>> 2.37.3
  
Bruno Larsen Oct. 31, 2022, 12:45 p.m. UTC | #4
On 28/10/2022 13:38, Andrew Burgess wrote:
> Bruno Larsen <blarsen@redhat.com> writes:
>
>> On 26/10/2022 16:08, Andrew Burgess wrote:
>>> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
>>>> When running gdb.cp/ptype-flags.exp using clang, we get an unexpected
>>>> failure when printing the type of a class with an internal typedef. This
>>>> happens because clang doesn't add accessibility information for typedefs
>>>> inside classes (see https://github.com/llvm/llvm-project/issues/57608
>>>> for more info). To help with clang testing, an XFAIL was added to this
>>>> test.
>>>> ---
>>>>    gdb/testsuite/gdb.cp/ptype-flags.exp | 12 ++++++++++++
>>>>    1 file changed, 12 insertions(+)
>>>>
>>>> diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
>>>> index f88c83e03ce..e8d3f285803 100644
>>>> --- a/gdb/testsuite/gdb.cp/ptype-flags.exp
>>>> +++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
>>>> @@ -30,11 +30,18 @@ if ![runto_main] then {
>>>>        return
>>>>    }
>>>>    
>>>> +if {[test_compiler_info {clang-*-*}]} {
>>>> +    set using_clang true
>>>> +} else {
>>>> +    set using_clang false
>>>> +}
>>> Missing the language for the test_compiler_info call.  Looks good with
>>> that fixed.
>> Great! Can I add an Approved-by tag to the patch?
> Sure, with that fix made.
Thanks! I pushed this patch with the change

Cheers,
Bruno

>
> Thanks,
> Andrew
>
>
>> Cheers,
>> Bruno
>>
>>> Thanks,
>>> Andrew
>>>
>>>> +
>>>>    gdb_test_no_output "set language c++" ""
>>>>    gdb_test_no_output "set width 0" ""
>>>>    
>>>>    proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>>>    		      {raw 0}} {
>>>> +    global using_clang
>>>>    
>>>>        set contents {
>>>>    	{ base "public Base<T>" }
>>>> @@ -49,6 +56,11 @@ proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
>>>>        }
>>>>    
>>>>        if {$show_typedefs} {
>>>> +	# Clang does not add accessibility information for typedefs:
>>>> +	# https://github.com/llvm/llvm-project/issues/57608
>>>> +	if {$using_clang} {
>>>> +	    setup_xfail "clang 57608" *-*-*
>>>> +	}
>>>>    	lappend contents { typedef public "typedef Simple<Simple<T> > Z;" }
>>>>        }
>>>>    
>>>> -- 
>>>> 2.37.3
  

Patch

diff --git a/gdb/testsuite/gdb.cp/ptype-flags.exp b/gdb/testsuite/gdb.cp/ptype-flags.exp
index f88c83e03ce..e8d3f285803 100644
--- a/gdb/testsuite/gdb.cp/ptype-flags.exp
+++ b/gdb/testsuite/gdb.cp/ptype-flags.exp
@@ -30,11 +30,18 @@  if ![runto_main] then {
     return
 }
 
+if {[test_compiler_info {clang-*-*}]} {
+    set using_clang true
+} else {
+    set using_clang false
+}
+
 gdb_test_no_output "set language c++" ""
 gdb_test_no_output "set width 0" ""
 
 proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
 		      {raw 0}} {
+    global using_clang
 
     set contents {
 	{ base "public Base<T>" }
@@ -49,6 +56,11 @@  proc do_check_holder {name {flags ""} {show_typedefs 1} {show_methods 1}
     }
 
     if {$show_typedefs} {
+	# Clang does not add accessibility information for typedefs:
+	# https://github.com/llvm/llvm-project/issues/57608
+	if {$using_clang} {
+	    setup_xfail "clang 57608" *-*-*
+	}
 	lappend contents { typedef public "typedef Simple<Simple<T> > Z;" }
     }