Hi all,
Last year, contrib/compare_test introduces non-unique test name check.
It is a good feature for new tests addition so that they will have no
more same test names, which will help identify bugs more precisely.
However, the legacy old tests got many non-unique names. This will
result in compare_tests showing tons of lines for non-unique names
at the beginning of the report. This actually reduced the readability
report when I am testing new patches whether there are test regressions.
This patch will not fix all the non-unique names (Definitely!). The fixed
amount non-unique names is around 70-75%. Still about 1/4 remaining. But
for a current 3400+ lines long non-unique name list for unix{-m32,-m64} under
x86_64, it is a big step.
For modules.exp, the patch appends std option into the report.
The layout change example:
- 3 PASS: g++: g++.dg/modules/access-1_a.C module-cmi Foo
(gcm.cache/Foo.gcm)
+ g++: g++.dg/modules/access-1_a.C -std=c++17 module-cmi Foo
(gcm.cache/Foo.gcm)
+ g++: g++.dg/modules/access-1_a.C -std=c++20 module-cmi Foo
(gcm.cache/Foo.gcm)
+ g++: g++.dg/modules/access-1_a.C -std=c++26 module-cmi Foo
(gcm.cache/Foo.gcm)
For lto.exp, the patch appends option testing into the report.
The layout change example:
- 6 PASS: g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3)
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O0
-flto -flto-partition=1to1 -fno-use-linker-plugin )
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O0
-flto -flto-partition=none -fuse-linker-plugin)
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O0
-flto -fuse-linker-plugin -fno-fat-lto-objects )
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O2
-flto -flto-partition=1to1 -fno-use-linker-plugin )
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O2
-flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects )
+ g++: g++.dg/lto/odr-1 (test for LTO warnings, odr-1_0.C line 3 -O2
-flto -fuse-linker-plugin)
For prettyprinters, the patch appends -flto or not into the report.
The layout change example:
- 2 PASS: libstdc++: libstdc++-prettyprinters/48362.cc execution test
+ libstdc++: libstdc++-prettyprinters/48362.cc -flto execution test
The other is the original non-lto one, which is unchanged.
Tested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk?
BTW, for the remaining non-unique name tests, should we open a (or several)
PR to track them. I am not sure if I am the only one being annoyed by
non-unique name test report.
Thx,
Haochen
---
gcc/testsuite/ChangeLog:
* g++.dg/modules/modules.exp (module_cmi_p): Add std parameter
and include it in test report. Update call site.
* lib/lto.exp (lto_handle_diagnostics_for_file): Add optstr
parameter and append it to the test report.
(lto_handle_diagnostics): Add optstr parameter.
(lto-link-and-maybe-run): Update lto_handle_diagnostics call site.
libstdc++-v3/ChangeLog:
* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Pass
-flto as the options to make it shown in test report.
---
gcc/testsuite/g++.dg/modules/modules.exp | 10 +++++-----
gcc/testsuite/lib/lto.exp | 15 +++++++++------
.../libstdc++-prettyprinters/prettyprinters.exp | 2 +-
3 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/gcc/testsuite/g++.dg/modules/modules.exp
b/gcc/testsuite/g++.dg/modules/modules.exp
index aa351b73e0e..3afbcb39e10 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -151,7 +151,7 @@ proc dg-module-cmi { args } {
# check the expected module files exist (or not)
# return list to delete
-proc module_cmi_p { src ifs } {
+proc module_cmi_p { src ifs std } {
set res {}
foreach if_arg $ifs {
set spec [lindex $if_arg 0]
@@ -169,9 +169,9 @@ proc module_cmi_p { src ifs } {
global srcdir
set relcmi [string map [list $srcdir "/\$srcdir"] $cmi]
if { $not != [file_on_host exists $cmi] } {
- pass "$src module-cmi $spec ($relcmi)"
+ pass "$src $std module-cmi $spec ($relcmi)"
} else {
- fail "$src module-cmi $spec ($relcmi)"
+ fail "$src $std module-cmi $spec ($relcmi)"
set not [expr ! $not ]
}
if { ! $not } {
@@ -369,7 +369,7 @@ foreach test [prune [lsort [find $srcdir/$subdir {*.[CH]}]]
\
continue
}
set testcase [string range $test [string length "$srcdir/"] end]
- cleanup_module_files [module_cmi_p $testcase $module_cmis]
+ cleanup_module_files [module_cmi_p $testcase $module_cmis $std]
}
}
}
@@ -417,7 +417,7 @@ foreach src [lsort [find $srcdir/$subdir {*_a.[CHX}]] {
break
}
set testcase [string range $test [string length "$srcdir/"]
end]
- lappend mod_files [module_cmi_p $testcase $module_cmis]
+ lappend mod_files [module_cmi_p $testcase $module_cmis $std]
}
}
set testcase [regsub {_a.[CH]} $src {}]
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 64b7d992272..036d7e6cc86 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -25,8 +25,9 @@
# MESSAGES_FOR_FILE is a list of expected messages, akin to DejaGnu's
# "dg-messages" variable.
# TEXT is the textual output from the LTO link.
+# OPTSTR is the LTO option set in effect.
-proc lto_handle_diagnostics_for_file { name filename messages_for_file text } {
+proc lto_handle_diagnostics_for_file { name filename messages_for_file text
optstr } {
global dg-linenum-format
set filename_without_path [file tail $filename]
@@ -69,8 +70,9 @@ proc lto_handle_diagnostics_for_file { name filename
messages_for_file text } {
# Unlike dg-test, add the filename to the PASS/FAIL message (rather
# than just the line number) so that the user can identify the
- # pertinent directive.
- set describe_where "$filename_without_path line $line"
+ # pertinent directive. Also append the option set, so that the same
+ # directive checked under several LTO options got a unique test name.
+ set describe_where "$filename_without_path line $line $optstr"
# Issue the PASS/FAIL, adding "LTO" to the messages (e.g. "LTO errors")
# to distinguish them from the non-LTO case (in case we ever need to
@@ -112,8 +114,9 @@ proc lto_handle_diagnostics_for_file { name filename
messages_for_file text } {
# Return TEXT, stripped of any diagnostics that were handled.
#
# TEXT is the textual output from the LTO link.
+# OPTSTR is the LTO option set in effect.
-proc lto_handle_diagnostics { text } {
+proc lto_handle_diagnostics { text optstr } {
global testcase
upvar dg-messages-by-file messages_by_file
@@ -128,7 +131,7 @@ proc lto_handle_diagnostics { text } {
set dg-messages $messages_by_file($src)
verbose " messages for $src: ${dg-messages}" 3
set text [lto_handle_diagnostics_for_file $testcase $src \
- ${dg-messages} $text]
+ ${dg-messages} $text $optstr]
}
verbose "lto_handle_diagnostics: exit: $text" 2
@@ -414,7 +417,7 @@ proc lto-link-and-maybe-run { testname objlist dest optall
optfile optstr } {
}
# Check for diagnostics specified by directives
- set comp_output [lto_handle_diagnostics $comp_output]
+ set comp_output [lto_handle_diagnostics $comp_output $optstr]
# Prune unimportant visibility warnings before checking output.
set comp_output [lto_prune_warns $comp_output]
diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
index dd3729744fa..4f56c4b0aad 100644
--- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
+++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp
@@ -52,7 +52,7 @@ if { [check_effective_target_lto] } {
# Work around linker bug https://sourceware.org/PR20882
regsub {^(.*)-Wl,--gc-sections(.*)$} $cxxldflags {\1\2} cxxldflags
gdb-dg-runtest [lsort [glob $srcdir/$subdir/*.cc]] \
- "" "$DEFAULT_CXXFLAGS -flto $PCH_CXXFLAGS"
+ "-flto" "$DEFAULT_CXXFLAGS $PCH_CXXFLAGS"
}
if [info exists guality_gdb_name] {
--
2.31.1