aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanis Johnson <janisjo@codesourcery.com>2012-06-26 03:10:43 +0000
committerJanis Johnson <janis@gcc.gnu.org>2012-06-26 03:10:43 +0000
commite3b205be21d6d891e9c1e7942d57af1c510d49fd (patch)
treef5cd6542f29ec0e5e82054de63def7a401fe8aaf /gcc
parent25038c7e71ccb02df8dd1a85304610720661dc38 (diff)
downloadgcc-e3b205be21d6d891e9c1e7942d57af1c510d49fd.zip
gcc-e3b205be21d6d891e9c1e7942d57af1c510d49fd.tar.gz
gcc-e3b205be21d6d891e9c1e7942d57af1c510d49fd.tar.bz2
target-supports-dg.exp (testname-for-summary): New.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog15
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp44
-rw-r--r--gcc/testsuite/lib/gcov.exp3
-rw-r--r--gcc/testsuite/lib/profopt.exp9
-rw-r--r--gcc/testsuite/lib/scanasm.exp65
-rw-r--r--gcc/testsuite/lib/scandump.exp22
-rw-r--r--gcc/testsuite/lib/target-supports-dg.exp28
7 files changed, 88 insertions, 98 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a8416dc..b4f21e7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,20 @@
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.
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 4666ede..3b9f9c0 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -433,10 +433,7 @@ proc cleanup-profile-file { } {
# 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??"
@@ -451,10 +448,7 @@ proc cleanup-coverage-files { } {
# 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"
@@ -492,10 +486,7 @@ proc cleanup-ipa-dump { suffix } {
# 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"
@@ -510,10 +501,7 @@ proc cleanup-stack-usage { } {
# 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"
@@ -550,10 +538,7 @@ proc cleanup-saved-temps { args } {
}
}
- # 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 {
@@ -584,7 +569,7 @@ proc scan-module { args } {
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 {
@@ -602,7 +587,7 @@ proc scan-module-absence { args } {
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 {
@@ -622,8 +607,8 @@ proc output-exists { args } {
}
}
- # 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] {
@@ -645,8 +630,8 @@ proc output-exists-not { args } {
}
}
- # 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] {
@@ -674,6 +659,7 @@ if { [info procs saved-dg-test] == [list] } {
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
@@ -684,6 +670,9 @@ if { [info procs saved-dg-test] == [list] } {
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
}
@@ -695,6 +684,9 @@ if { [info procs saved-dg-test] == [list] } {
if [info exists compiler_conditional_xfail_data] {
unset compiler_conditional_xfail_data
}
+ if [info exists testname_with_flags] {
+ unset testname_with_flags
+ }
}
}
diff --git a/gcc/testsuite/lib/gcov.exp b/gcc/testsuite/lib/gcov.exp
index 601330b..1cf93a7 100644
--- a/gcc/testsuite/lib/gcov.exp
+++ b/gcc/testsuite/lib/gcov.exp
@@ -265,8 +265,7 @@ proc run-gcov { args } {
}
}
- # 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]
diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index f0dbee7..b74b7ca 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -217,6 +217,7 @@ proc profopt-execute { src } {
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."
@@ -240,6 +241,12 @@ proc profopt-execute { src } {
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]
@@ -272,6 +279,7 @@ proc profopt-execute { src } {
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
}
@@ -437,4 +445,5 @@ proc profopt-execute { src } {
remote_file build delete $execname3
}
}
+ unset testname_with_flags
}
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index ebd3c61..51c19d3 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -78,10 +78,7 @@ proc dg-scan { name positive testcase output_file orig_args } {
# 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
}
@@ -95,10 +92,7 @@ proc scan-assembler_required_options { 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
@@ -128,10 +122,7 @@ proc hidden-scan-for { symbol } {
# 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]
@@ -147,10 +138,7 @@ proc scan-hidden { args } {
# 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]
@@ -164,10 +152,7 @@ proc scan-not-hidden { args } {
# 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
}
@@ -175,10 +160,7 @@ proc scan-file { 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
}
@@ -186,10 +168,7 @@ proc scan-file-not { 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
@@ -199,10 +178,7 @@ proc scan-stack-usage { 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
@@ -227,14 +203,7 @@ proc scan-assembler-times { 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]
@@ -292,10 +261,7 @@ proc scan-assembler-dem { args } {
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"
@@ -349,10 +315,7 @@ proc scan-assembler-dem-not { args } {
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"
@@ -407,11 +370,7 @@ proc object-size { args } {
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 } {
diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp
index 7cde2a2..80b554b 100644
--- a/gcc/testsuite/lib/scandump.exp
+++ b/gcc/testsuite/lib/scandump.exp
@@ -45,10 +45,7 @@ proc scan-dump { args } {
}
}
- # 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]\""
@@ -88,11 +85,7 @@ proc scan-dump-times { args } {
}
}
- # 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]"
@@ -132,11 +125,7 @@ proc scan-dump-not { args } {
}
}
- # 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]]
@@ -188,7 +177,7 @@ proc scan-dump-dem { args } {
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]]
@@ -239,8 +228,7 @@ proc scan-dump-dem-not { args } {
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]]
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp
index a8f0a69..2f6c4c2 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -31,6 +31,34 @@ proc current_compiler_flags { } {
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 } {