[10/11] gdb/testsuite: remove XFAIL on gdb.cp/temargs.exp

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

Commit Message

Guinevere Larsen Oct. 4, 2022, 5:07 p.m. UTC
  gdb.cp/temargs.exp last 2 tests always setup an XFAILs, despite checking
for old gcc versions.  However, clang does not fail in this test,
turning into XPASSes and slighty annoying when comparing between
compilers.  To change this, make the xfails only happen if we are not
using clang.
---
 gdb/testsuite/gdb.cp/temargs.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

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

> gdb.cp/temargs.exp last 2 tests always setup an XFAILs, despite checking
> for old gcc versions.  However, clang does not fail in this test,
> turning into XPASSes and slighty annoying when comparing between
> compilers.  To change this, make the xfails only happen if we are not
> using clang.
> ---
>  gdb/testsuite/gdb.cp/temargs.exp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp
> index 05fd902bb83..135cf316b90 100644
> --- a/gdb/testsuite/gdb.cp/temargs.exp
> +++ b/gdb/testsuite/gdb.cp/temargs.exp
> @@ -46,6 +46,8 @@ if {[test_compiler_info {gcc-[0-3]-*}]
>      set have_pr_45024_fixed 0
>  }
>  
> +set using_clang [test_compiler_info clang-*-*]
> +
>  set line [gdb_get_line_number "Breakpoint 1" $srcfile]
>  gdb_test "break $srcfile:$line" "Breakpoint 2.*" \
>      "set first breakpoint for temargs"
> @@ -190,10 +192,10 @@ gdb_test "print F" "&S::somefunc" "test value of F in k2_m"
>  gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
>  
>  if $have_older_template_gcc { setup_xfail "*-*-*"
> -} else { setup_xfail gcc/49546 "*-*-*" }
> +} elseif !$using_clang { setup_xfail gcc/49546 "*-*-*" }

Surely, if these XFAIL are for GCC, then the right thing here is to
check _for_ GCC, instead of checking !Clang?  I'd assume other non-GCC
compilers will also XPASS this test.

Thanks,
Andrew

>  gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
>  
>  if $have_older_template_gcc { setup_xfail "*-*-*"
> -} else { setup_xfail gcc/49546 "*-*-*" }
> +} elseif !$using_clang { setup_xfail gcc/49546 "*-*-*" }
>  gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
>  	 "test value of F in k3_m"
> -- 
> 2.37.3
  

Patch

diff --git a/gdb/testsuite/gdb.cp/temargs.exp b/gdb/testsuite/gdb.cp/temargs.exp
index 05fd902bb83..135cf316b90 100644
--- a/gdb/testsuite/gdb.cp/temargs.exp
+++ b/gdb/testsuite/gdb.cp/temargs.exp
@@ -46,6 +46,8 @@  if {[test_compiler_info {gcc-[0-3]-*}]
     set have_pr_45024_fixed 0
 }
 
+set using_clang [test_compiler_info clang-*-*]
+
 set line [gdb_get_line_number "Breakpoint 1" $srcfile]
 gdb_test "break $srcfile:$line" "Breakpoint 2.*" \
     "set first breakpoint for temargs"
@@ -190,10 +192,10 @@  gdb_test "print F" "&S::somefunc" "test value of F in k2_m"
 gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
 
 if $have_older_template_gcc { setup_xfail "*-*-*"
-} else { setup_xfail gcc/49546 "*-*-*" }
+} elseif !$using_clang { setup_xfail gcc/49546 "*-*-*" }
 gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
 
 if $have_older_template_gcc { setup_xfail "*-*-*"
-} else { setup_xfail gcc/49546 "*-*-*" }
+} elseif !$using_clang { setup_xfail gcc/49546 "*-*-*" }
 gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
 	 "test value of F in k3_m"