libstdc++: Add xfail to pretty printer tests that fail in C++20
For some reason the type printer for std::string doesn't work in C++20
mode, so std::basic_string<char, char_traits<char>, allocator<char> is
printed out in full rather than being shown as std::string. It's
probably related to the fact that the extern template declarations are
disabled for C++20, but I don't know why that affects GDB.
For now I'm just marking the relevant tests as XFAIL. That requires
adding support for target selectors to individual GDB directives such as
note-test and whatis-regexp-test.
libstdc++-v3/ChangeLog:
* testsuite/lib/gdb-test.exp: Add target selector support to the
dg-final directives.
* testsuite/libstdc++-prettyprinters/80276.cc: Add xfail for
C++20.
* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Tweak
comment.
(cherry picked from commit 30b8ec68e2
)
This commit is contained in:
parent
4c6e66a4db
commit
1d2336f846
|
@ -50,40 +50,48 @@ proc get_line_number {filename marker} {
|
||||||
return $gdb_markers($filename,$marker)
|
return $gdb_markers($filename,$marker)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make note of a gdb test. A test consists of a variable name and an
|
proc register_gdb_test {var result kind rexp selector} {
|
||||||
# expected result.
|
|
||||||
proc note-test {var result} {
|
|
||||||
global gdb_tests
|
global gdb_tests
|
||||||
|
|
||||||
lappend gdb_tests $var $result print 0
|
set xfail 0
|
||||||
|
if {[string length $selector] > 0} {
|
||||||
|
switch [dg-process-target $selector] {
|
||||||
|
"N" { return }
|
||||||
|
"S" { }
|
||||||
|
"P" { }
|
||||||
|
"F" { set xfail 1 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lappend gdb_tests $var $result $kind $rexp $xfail
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make note of a gdb test. A test consists of a variable name and an
|
||||||
|
# expected result, and an optional target selector.
|
||||||
|
proc note-test {var result {selector {}}} {
|
||||||
|
register_gdb_test $var $result print 0 $selector
|
||||||
}
|
}
|
||||||
|
|
||||||
# A test that uses a regular expression. This is like note-test, but
|
# A test that uses a regular expression. This is like note-test, but
|
||||||
# the result is a regular expression that is matched against the
|
# the result is a regular expression that is matched against the
|
||||||
# output.
|
# output.
|
||||||
proc regexp-test {var result} {
|
proc regexp-test {var result {selector {}}} {
|
||||||
global gdb_tests
|
register_gdb_test $var $result print 1 $selector
|
||||||
|
|
||||||
lappend gdb_tests $var $result print 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# A test of 'whatis'. This tests a type rather than a variable.
|
# A test of 'whatis'. This tests a type rather than a variable.
|
||||||
proc whatis-test {var result} {
|
proc whatis-test {var result {selector {}}} {
|
||||||
global gdb_tests
|
register_gdb_test $var $result whatis 0 $selector
|
||||||
|
|
||||||
lappend gdb_tests $var $result whatis 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# A test of 'whatis' that uses a regular expression. This tests a type rather
|
# A test of 'whatis' that uses a regular expression. This tests a type rather
|
||||||
# than a variable.
|
# than a variable.
|
||||||
proc whatis-regexp-test {var result} {
|
proc whatis-regexp-test {var result {selector {}}} {
|
||||||
global gdb_tests
|
register_gdb_test $var $result whatis 1 $selector
|
||||||
|
|
||||||
lappend gdb_tests $var $result whatis 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Utility for testing variable values using gdb, invoked via dg-final.
|
# Utility for testing variable values using gdb, invoked via dg-final.
|
||||||
# Tests all tests indicated by note-test and regexp-test.
|
# Tests all tests indicated by note-test, whatis-test, and the regexp versions.
|
||||||
#
|
#
|
||||||
# Argument 0 is the marker on which to put a breakpoint
|
# Argument 0 is the marker on which to put a breakpoint
|
||||||
# Argument 2 handles expected failures and the like
|
# Argument 2 handles expected failures and the like
|
||||||
|
@ -144,7 +152,7 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } {
|
||||||
puts $fd "info share"
|
puts $fd "info share"
|
||||||
|
|
||||||
set count 0
|
set count 0
|
||||||
foreach {var result kind rexp} $gdb_tests {
|
foreach {var result kind rexp xfail} $gdb_tests {
|
||||||
incr count
|
incr count
|
||||||
set gdb_var($count) $var
|
set gdb_var($count) $var
|
||||||
set gdb_expected($count) $result
|
set gdb_expected($count) $result
|
||||||
|
@ -152,6 +160,7 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } {
|
||||||
if {$do_whatis_tests} {
|
if {$do_whatis_tests} {
|
||||||
set gdb_is_type($count) 1
|
set gdb_is_type($count) 1
|
||||||
set gdb_is_regexp($count) $rexp
|
set gdb_is_regexp($count) $rexp
|
||||||
|
set gdb_is_xfail($count) $xfail
|
||||||
set gdb_command($count) "whatis $var"
|
set gdb_command($count) "whatis $var"
|
||||||
} else {
|
} else {
|
||||||
unsupported "$testname"
|
unsupported "$testname"
|
||||||
|
@ -161,6 +170,7 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } {
|
||||||
} else {
|
} else {
|
||||||
set gdb_is_type($count) 0
|
set gdb_is_type($count) 0
|
||||||
set gdb_is_regexp($count) $rexp
|
set gdb_is_regexp($count) $rexp
|
||||||
|
set gdb_is_xfail($count) $xfail
|
||||||
set gdb_command($count) "print $var"
|
set gdb_command($count) "print $var"
|
||||||
}
|
}
|
||||||
puts $fd $gdb_command($count)
|
puts $fd $gdb_command($count)
|
||||||
|
@ -198,12 +208,21 @@ proc gdb-test { marker {selector {}} {load_xmethods 0} } {
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$match} {
|
if {$match} {
|
||||||
|
if {$gdb_is_xfail($test_counter)} {
|
||||||
|
xpass "$testname $gdb_command($test_counter)"
|
||||||
|
verbose " matched =>$first<="
|
||||||
|
} else {
|
||||||
pass "$testname $gdb_command($test_counter)"
|
pass "$testname $gdb_command($test_counter)"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if {$gdb_is_xfail($test_counter)} {
|
||||||
|
xfail "$testname $gdb_command($test_counter)"
|
||||||
} else {
|
} else {
|
||||||
fail "$testname $gdb_command($test_counter)"
|
fail "$testname $gdb_command($test_counter)"
|
||||||
verbose " got =>$first<="
|
verbose " got =>$first<="
|
||||||
verbose "expected =>$gdb_expected($test_counter)<="
|
verbose "expected =>$gdb_expected($test_counter)<="
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if {$test_counter == $count} {
|
if {$test_counter == $count} {
|
||||||
remote_close target
|
remote_close target
|
||||||
|
|
|
@ -46,7 +46,7 @@ main()
|
||||||
// { dg-final { whatis-regexp-test p1 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?vector<int>\\*>>>" } }
|
// { dg-final { whatis-regexp-test p1 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?vector<int>\\*>>>" } }
|
||||||
// { dg-final { whatis-regexp-test p2 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?set<int>\\*>>\\\[\\\]>" } }
|
// { dg-final { whatis-regexp-test p2 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?set<int>\\*>>\\\[\\\]>" } }
|
||||||
// { dg-final { whatis-regexp-test p3 "std::unique_ptr<std::(__debug::)?set<std::unique_ptr<std::(__debug::)?vector<int>\\*>>\\\[10\\\]>" } }
|
// { dg-final { whatis-regexp-test p3 "std::unique_ptr<std::(__debug::)?set<std::unique_ptr<std::(__debug::)?vector<int>\\*>>\\\[10\\\]>" } }
|
||||||
// { dg-final { whatis-regexp-test p4 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?list<std::string>\\\[\\\]>>\\\[99\\\]>" } }
|
// { dg-final { whatis-regexp-test p4 "std::unique_ptr<std::(__debug::)?vector<std::unique_ptr<std::(__debug::)?list<std::string>\\\[\\\]>>\\\[99\\\]>" { xfail c++20 } } }
|
||||||
|
|
||||||
placeholder(&p1); // Mark SPOT
|
placeholder(&p1); // Mark SPOT
|
||||||
placeholder(&p2);
|
placeholder(&p2);
|
||||||
|
|
|
@ -50,7 +50,7 @@ main()
|
||||||
om = std::map<int, double>{ {1, 2.}, {3, 4.}, {5, 6.} };
|
om = std::map<int, double>{ {1, 2.}, {3, 4.}, {5, 6.} };
|
||||||
// { dg-final { regexp-test om {std::experimental::optional<std::(__debug::)?map<int, double>> containing std::(__debug::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } }
|
// { dg-final { regexp-test om {std::experimental::optional<std::(__debug::)?map<int, double>> containing std::(__debug::)?map with 3 elements = {\[1\] = 2, \[3\] = 4, \[5\] = 6}} } }
|
||||||
optional<std::string> os{ "stringy" };
|
optional<std::string> os{ "stringy" };
|
||||||
// { dg-final { note-test os {std::experimental::optional<std::string> = {[contained value] = "stringy"}} } }
|
// { dg-final { note-test os {std::experimental::optional<std::string> = {[contained value] = "stringy"}} { xfail c++20 } } }
|
||||||
|
|
||||||
any a;
|
any a;
|
||||||
// { dg-final { note-test a {std::experimental::any [no contained value]} } }
|
// { dg-final { note-test a {std::experimental::any [no contained value]} } }
|
||||||
|
@ -61,7 +61,7 @@ main()
|
||||||
any ap = (void*)nullptr;
|
any ap = (void*)nullptr;
|
||||||
// { dg-final { note-test ap {std::experimental::any containing void * = {[contained value] = 0x0}} } }
|
// { dg-final { note-test ap {std::experimental::any containing void * = {[contained value] = 0x0}} } }
|
||||||
any as = *os;
|
any as = *os;
|
||||||
// { dg-final { note-test as {std::experimental::any containing std::string = {[contained value] = "stringy"}} } }
|
// { dg-final { note-test as {std::experimental::any containing std::string = {[contained value] = "stringy"}} { xfail c++20 } } }
|
||||||
any as2("stringiest");
|
any as2("stringiest");
|
||||||
// { dg-final { regexp-test as2 {std::experimental::any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } }
|
// { dg-final { regexp-test as2 {std::experimental::any containing const char \* = {\[contained value\] = 0x[[:xdigit:]]+ "stringiest"}} } }
|
||||||
any am = *om;
|
any am = *om;
|
||||||
|
|
|
@ -49,7 +49,7 @@ gdb-dg-runtest [lsort [glob $srcdir/$subdir/*.cc]] \
|
||||||
|
|
||||||
if { [check_effective_target_lto] } {
|
if { [check_effective_target_lto] } {
|
||||||
append cxxflags " -flto"
|
append cxxflags " -flto"
|
||||||
# work around sourceware.org 20882
|
# Work around linker bug https://sourceware.org/PR20882
|
||||||
regsub {^(.*)-Wl,--gc-sections(.*)$} $cxxldflags {\1\2} cxxldflags
|
regsub {^(.*)-Wl,--gc-sections(.*)$} $cxxldflags {\1\2} cxxldflags
|
||||||
gdb-dg-runtest [lsort [glob $srcdir/$subdir/*.cc]] \
|
gdb-dg-runtest [lsort [glob $srcdir/$subdir/*.cc]] \
|
||||||
"" "$DEFAULT_CXXFLAGS -flto $PCH_CXXFLAGS"
|
"" "$DEFAULT_CXXFLAGS -flto $PCH_CXXFLAGS"
|
||||||
|
|
Loading…
Reference in New Issue