From: Tom de Vries Date: Mon, 28 Aug 2023 21:42:11 +0000 (+0200) Subject: [gdb/testsuite] Improve xfail in gdb.cp/nsusing.exp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0789a13f8af55f58cb97ca7d61fe0480512728c3;p=binutils-gdb.git [gdb/testsuite] Improve xfail in gdb.cp/nsusing.exp In test-case gdb.cp/nsusing.exp I came across these xfails without PRMS mentioned: ... XFAIL: gdb.cp/nsusing.exp: print x, before using statement XFAIL: gdb.cp/nsusing.exp: print x, only using M ... Add the missing PRMS, such that we have: ... XFAIL: gdb.cp/nsusing.exp: print x, before using statement (PRMS gcc/108716) XFAIL: gdb.cp/nsusing.exp: print x, only using M (PRMS gcc/108716) ... and limit the xfail to unfixed versions. The PR is fixed starting gcc 13, but it has been backported to release branches stretching back to gcc 10. For simplicity we just stick to testing for the major version and ignore the backported fixes. Tested on x86_64-linux. Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp index f34910bac0d..d44e389a8bb 100644 --- a/gdb/testsuite/gdb.cp/nsusing.exp +++ b/gdb/testsuite/gdb.cp/nsusing.exp @@ -122,14 +122,23 @@ if { [test_compiler_info {gcc-[0-3]-*}] || return } +# Xfail for incorrect decl_line on DW_TAG_imported_module, +# gcc PR debug/108716. +set have_gcc108716_xfail \ + [expr [test_compiler_info gcc-*] && [gcc_major_version] < 13] + gdb_test_multiple "print x" "print x, before using statement" { -re -wrap "No symbol .x. in current context.*" { pass $gdb_test_name } -re -wrap "Reference to .x. is ambiguous.*" { - # GCC doesn't properly set the decl_line for namespaces, so GDB believes - # that the "using namespace M" line has already passed at this point. - xfail $gdb_test_name + if { $have_gcc108716_xfail } { + # GCC doesn't properly set the decl_line for namespaces, so GDB + # believes that the "using namespace M" line has already passed at + # this point. + setup_xfail *-*-* gcc/108716 + } + fail $gdb_test_name } } gdb_test "next" ".*" "using namespace M" @@ -138,7 +147,10 @@ gdb_test_multiple "print x" "print x, only using M" { pass $gdb_test_name } -re -wrap "Reference to .x. is ambiguous.*" { - xfail $gdb_test_name + if { $have_gcc108716_xfail } { + setup_xfail *-*-* gcc/108716 + } + fail $gdb_test_name } } gdb_test "next" ".*" "using namespace N"