* lib/target-supports-dg.exp (testname-for-summary): New.
* lib/profopt.exp (profopt_execute): Define testname_with_flags.
* lib/gcc-dg.exp (cleanup-coverage-files, cleanup-repo-notes,
cleanup-stack-usage, cleanup-dump, cleanup-saved-temps, scan-module,
scan-module-absence, output-exists, output-exists-not: Use
testname-for-summary.
(dg-test): Clean up testname_with_flags.
* lib/scanasm.exp (scan-assembler, scan-assembler-not, scan-hidden,
scan-not-hidden, scan-file, scan-file-not, scan-stack-usage,
scan-stack-usage-not, scan-assembler-times, scan-assembler-dem,
scan-assembler-dem-not, object-size: Use testname-for-summary.
* lib/gcov.exp (run-gcov): Likewise.
* lib/scandump.exp (scan-dump, scan-dump-times, scan-dump-not,
scan-dump-dem, scan-dump-dem-note): Likewise.
From-SVN: r188972
2012-06-25 Janis Johnson <janisjo@codesourcery.com>
+ * lib/target-supports-dg.exp (testname-for-summary): New.
+ * lib/profopt.exp (profopt_execute): Define testname_with_flags.
+ * lib/gcc-dg.exp (cleanup-coverage-files, cleanup-repo-notes,
+ cleanup-stack-usage, cleanup-dump, cleanup-saved-temps, scan-module,
+ scan-module-absence, output-exists, output-exists-not: Use
+ testname-for-summary.
+ (dg-test): Clean up testname_with_flags.
+ * lib/scanasm.exp (scan-assembler, scan-assembler-not, scan-hidden,
+ scan-not-hidden, scan-file, scan-file-not, scan-stack-usage,
+ scan-stack-usage-not, scan-assembler-times, scan-assembler-dem,
+ scan-assembler-dem-not, object-size: Use testname-for-summary.
+ * lib/gcov.exp (run-gcov): Likewise.
+ * lib/scandump.exp (scan-dump, scan-dump-times, scan-dump-not,
+ scan-dump-dem, scan-dump-dem-note): Likewise.
+
* lib/profopt.exp: Make prof_option_list local to profopt-execute.
* g++.dg/tree-prof/tree-prof.exp (PROFOPT_OPTIONS): Define after
including profopt.opt; save and restore existing value.
# Remove compiler-generated coverage files for the current test.
proc cleanup-coverage-files { } {
- # This assumes that we are two frames down from dg-test or some other proc
- # that stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].gc??"
# Remove compiler-generated files from -repo for the current test.
proc cleanup-repo-files { } {
- # This assumes that we are two frames down from dg-test or some other proc
- # that stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].o"
# Remove a stack usage file for the current test.
proc cleanup-stack-usage { } {
- # This assumes that we are two frames down from dg-test or some other proc
- # that stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].su"
# Remove all dump files with the provided suffix.
proc cleanup-dump { suffix } {
- # This assumes that we are three frames down from dg-test or some other
- # proc that stores the filename of the testcase in a local variable
- # "name". A cleaner solution would require a new DejaGnu release.
- upvar 3 name testcase
+ set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set src [file tail [lindex $testcase 0]]
remove-build-file "[file tail $src].$suffix"
}
}
- # This assumes that we are two frames down from dg-test or some other proc
- # that stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
# The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0]
foreach suffix $suffixes {
set text [read $fd]
close $fd
- upvar 2 name testcase
+ set testcase [testname-for-summary]
if [regexp -- [lindex $args 1] $text] {
pass "$testcase scan-module [lindex $args 1]"
} else {
set text [read $fd]
close $fd
- upvar 2 name testcase
+ set testcase [testname-for-summary]
if [regexp -- [lindex $args 1] $text] {
fail "$testcase scan-module [lindex $args 1]"
} else {
}
}
- # Access variables from gcc-dg-test-1.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
+ # Access variable from gcc-dg-test-1.
upvar 2 output_file output_file
if [file exists $output_file] {
}
}
- # Access variables from gcc-dg-test-1.
- upvar 2 name testcase
+ set testcase [testname-for-summary]
+ # Access variable from gcc-dg-test-1.
upvar 2 output_file output_file
if [file exists $output_file] {
global errorInfo
global compiler_conditional_xfail_data
global shouldfail
+ global testname_with_flags
if { [ catch { eval saved-dg-test $args } errmsg ] } {
set saved_info $errorInfo
if [info exists compiler_conditional_xfail_data] {
unset compiler_conditional_xfail_data
}
+ if [info exists testname_with_flags] {
+ unset testname_with_flags
+ }
unset_timeout_vars
error $errmsg $saved_info
}
if [info exists compiler_conditional_xfail_data] {
unset compiler_conditional_xfail_data
}
+ if [info exists testname_with_flags] {
+ unset testname_with_flags
+ }
}
}
}
}
- # Get the test name, including options that make it unique, from gnu-test 2 levels up.
- upvar 2 name testname
+ set testname [testname-for-summary]
# Extract the test file name from the arguments.
set testcase [lindex $gcov_args end]
global tool profile_option feedback_option prof_ext perf_ext perf_delta
global generate_final_code use_final_code
global verbose
+ global testname_with_flags
if ![info exists profile_option] {
error "No profile option specified for first compile."
set testcase "[file tail [file dirname $src]]/[file tail $src]"
}
+ # Several procedures access the name of the test with torture flags,
+ # normally defined in dg-test. Profile optimization tests don't
+ # use dg-test, so define it here to make it accessible via
+ # testname-for-summary.
+ set testname_with_flags $testcase
+
set executable $tmpdir/[file tail [file rootname $src].x]
set basename [file tail $testcase]
set base [file rootname $basename]
set extra_flags [profopt-get-options $src]
if { [lindex ${dg-do-what} 1 ] == "N" } {
unsupported "$src"
+ unset testname_with_flags
verbose "$src not supported on this target, skipping it" 3
return
}
remote_file build delete $execname3
}
}
+ unset testname_with_flags
}
# dg-scan for details.
proc scan-assembler { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].s"
dg-scan "scan-assembler" 1 $testcase $output_file $args
}
# compiler. See dg-scan for details.
proc scan-assembler-not { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].s"
dg-scan "scan-assembler-not" 0 $testcase $output_file $args
# produced by the compiler.
proc scan-hidden { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0]
# produced by the compiler.
proc scan-not-hidden { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0]
# Look for a pattern in OUTPUT_FILE. See dg-scan for details.
proc scan-file { output_file args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
dg-scan "scan-file" 1 $testcase $output_file $args
}
# for details.
proc scan-file-not { output_file args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
dg-scan "scan-file-not" 0 $testcase $output_file $args
}
# dg-scan for details.
proc scan-stack-usage { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].su"
dg-scan "scan-file" 1 $testcase $output_file $args
# compiler. See dg-scan for details.
proc scan-stack-usage-not { args } {
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set output_file "[file rootname [file tail $testcase]].su"
dg-scan "scan-file-not" 0 $testcase $output_file $args
}
}
- # This assumes that we are two frames down from dg-test, and that
- # it still stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new dejagnu release.
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
-
+ set testcase [testname-for-summary]
set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern]
verbose -log "c++filt is $cxxfilt"
}
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern]
set output_file "[file rootname [file tail $testcase]].s"
verbose -log "c++filt is $cxxfilt"
}
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
+ set testcase [testname-for-summary]
set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern]
set output_file "[file rootname [file tail $testcase]].s"
verbose -log "size is $size"
}
- upvar 2 name testcase
- if { [llength $testcase] > 1 } {
- set testcase "$testcase "
- }
-
+ set testcase [testname-for-summary]
set what [lindex $args 0]
set where [lsearch { text data bss total } $what]
if { $where == -1 } {
}
}
- # This assumes that we are three frames down from dg-test, and that
- # it still stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 3 name testcase
+ set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
}
}
- # This assumes that we are three frames down from dg-test, and that
- # it still stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 3 name testcase
-
+ set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 3]]
set printable_pattern [make_pattern_printable [lindex $args 1]]
set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"$printable_pattern\" [lindex $args 2]"
}
}
- # This assumes that we are three frames down from dg-test, and that
- # it still stores the filename of the testcase in a local variable "name".
- # A cleaner solution would require a new DejaGnu release.
- upvar 3 name testcase
-
+ set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]]
verbose -log "c++filt is $cxxfilt"
}
- upvar 3 name testcase
+ set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]]
verbose -log "c++filt is $cxxfilt"
}
- upvar 3 name testcase
-
+ set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]]
return "$flags1 $flags2"
}
+# DejaGnu's dg-test defines a test name that includes torture options
+# which is used in most pass/fail messages. Grab a copy of it.
+
+proc testname-for-summary { } {
+ global testname_with_flags
+
+ # A variable called "name" is too generic, so identify dg-test by
+ # the existence of dg-extra-tool-flags.
+ if ![info exists testname_with_flags] {
+ set frames 2
+ while { ![info exists flags] } {
+ set frames [expr $frames + 1]
+ upvar $frames dg-extra-tool-flags flags
+ }
+
+ # We've got the stack level for dg-test; get the variable we want.
+ upvar $frames name name
+ set testname_with_flags $name
+
+ # If there are flags, add an extra space to improve readability of
+ # the test summary.
+ if { [llength $testname_with_flags] > 1 } {
+ set testname_with_flags "$testname_with_flags "
+ }
+ }
+ return "$testname_with_flags"
+}
+
# If this target does not support weak symbols, skip this test.
proc dg-require-weak { args } {