Commit e3b205be by Janis Johnson Committed by Janis Johnson

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
parent 25038c7e
2012-06-25 Janis Johnson <janisjo@codesourcery.com> 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. * lib/profopt.exp: Make prof_option_list local to profopt-execute.
* g++.dg/tree-prof/tree-prof.exp (PROFOPT_OPTIONS): Define after * g++.dg/tree-prof/tree-prof.exp (PROFOPT_OPTIONS): Define after
including profopt.opt; save and restore existing value. including profopt.opt; save and restore existing value.
......
...@@ -433,10 +433,7 @@ proc cleanup-profile-file { } { ...@@ -433,10 +433,7 @@ proc cleanup-profile-file { } {
# Remove compiler-generated coverage files for the current test. # Remove compiler-generated coverage files for the current test.
proc cleanup-coverage-files { } { proc cleanup-coverage-files { } {
# This assumes that we are two frames down from dg-test or some other proc set testcase [testname-for-summary]
# 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
# The name might include a list of options; extract the file name. # The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0] set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].gc??" remove-build-file "[file rootname [file tail $testcase]].gc??"
...@@ -451,10 +448,7 @@ proc cleanup-coverage-files { } { ...@@ -451,10 +448,7 @@ proc cleanup-coverage-files { } {
# Remove compiler-generated files from -repo for the current test. # Remove compiler-generated files from -repo for the current test.
proc cleanup-repo-files { } { proc cleanup-repo-files { } {
# This assumes that we are two frames down from dg-test or some other proc set testcase [testname-for-summary]
# 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
# The name might include a list of options; extract the file name. # The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0] set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].o" remove-build-file "[file rootname [file tail $testcase]].o"
...@@ -492,10 +486,7 @@ proc cleanup-ipa-dump { suffix } { ...@@ -492,10 +486,7 @@ proc cleanup-ipa-dump { suffix } {
# Remove a stack usage file for the current test. # Remove a stack usage file for the current test.
proc cleanup-stack-usage { } { proc cleanup-stack-usage { } {
# This assumes that we are two frames down from dg-test or some other proc set testcase [testname-for-summary]
# 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
# The name might include a list of options; extract the file name. # The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0] set testcase [lindex $testcase 0]
remove-build-file "[file rootname [file tail $testcase]].su" remove-build-file "[file rootname [file tail $testcase]].su"
...@@ -510,10 +501,7 @@ proc cleanup-stack-usage { } { ...@@ -510,10 +501,7 @@ proc cleanup-stack-usage { } {
# Remove all dump files with the provided suffix. # Remove all dump files with the provided suffix.
proc cleanup-dump { suffix } { proc cleanup-dump { suffix } {
# This assumes that we are three frames down from dg-test or some other set testcase [testname-for-summary]
# 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
# The name might include a list of options; extract the file name. # The name might include a list of options; extract the file name.
set src [file tail [lindex $testcase 0]] set src [file tail [lindex $testcase 0]]
remove-build-file "[file tail $src].$suffix" remove-build-file "[file tail $src].$suffix"
...@@ -550,10 +538,7 @@ proc cleanup-saved-temps { args } { ...@@ -550,10 +538,7 @@ proc cleanup-saved-temps { args } {
} }
} }
# This assumes that we are two frames down from dg-test or some other proc set testcase [testname-for-summary]
# 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
# The name might include a list of options; extract the file name. # The name might include a list of options; extract the file name.
set testcase [lindex $testcase 0] set testcase [lindex $testcase 0]
foreach suffix $suffixes { foreach suffix $suffixes {
...@@ -584,7 +569,7 @@ proc scan-module { args } { ...@@ -584,7 +569,7 @@ proc scan-module { args } {
set text [read $fd] set text [read $fd]
close $fd close $fd
upvar 2 name testcase set testcase [testname-for-summary]
if [regexp -- [lindex $args 1] $text] { if [regexp -- [lindex $args 1] $text] {
pass "$testcase scan-module [lindex $args 1]" pass "$testcase scan-module [lindex $args 1]"
} else { } else {
...@@ -602,7 +587,7 @@ proc scan-module-absence { args } { ...@@ -602,7 +587,7 @@ proc scan-module-absence { args } {
set text [read $fd] set text [read $fd]
close $fd close $fd
upvar 2 name testcase set testcase [testname-for-summary]
if [regexp -- [lindex $args 1] $text] { if [regexp -- [lindex $args 1] $text] {
fail "$testcase scan-module [lindex $args 1]" fail "$testcase scan-module [lindex $args 1]"
} else { } else {
...@@ -622,8 +607,8 @@ proc output-exists { args } { ...@@ -622,8 +607,8 @@ proc output-exists { args } {
} }
} }
# Access variables from gcc-dg-test-1. set testcase [testname-for-summary]
upvar 2 name testcase # Access variable from gcc-dg-test-1.
upvar 2 output_file output_file upvar 2 output_file output_file
if [file exists $output_file] { if [file exists $output_file] {
...@@ -645,8 +630,8 @@ proc output-exists-not { args } { ...@@ -645,8 +630,8 @@ proc output-exists-not { args } {
} }
} }
# Access variables from gcc-dg-test-1. set testcase [testname-for-summary]
upvar 2 name testcase # Access variable from gcc-dg-test-1.
upvar 2 output_file output_file upvar 2 output_file output_file
if [file exists $output_file] { if [file exists $output_file] {
...@@ -674,6 +659,7 @@ if { [info procs saved-dg-test] == [list] } { ...@@ -674,6 +659,7 @@ if { [info procs saved-dg-test] == [list] } {
global errorInfo global errorInfo
global compiler_conditional_xfail_data global compiler_conditional_xfail_data
global shouldfail global shouldfail
global testname_with_flags
if { [ catch { eval saved-dg-test $args } errmsg ] } { if { [ catch { eval saved-dg-test $args } errmsg ] } {
set saved_info $errorInfo set saved_info $errorInfo
...@@ -684,6 +670,9 @@ if { [info procs saved-dg-test] == [list] } { ...@@ -684,6 +670,9 @@ if { [info procs saved-dg-test] == [list] } {
if [info exists compiler_conditional_xfail_data] { if [info exists compiler_conditional_xfail_data] {
unset compiler_conditional_xfail_data unset compiler_conditional_xfail_data
} }
if [info exists testname_with_flags] {
unset testname_with_flags
}
unset_timeout_vars unset_timeout_vars
error $errmsg $saved_info error $errmsg $saved_info
} }
...@@ -695,6 +684,9 @@ if { [info procs saved-dg-test] == [list] } { ...@@ -695,6 +684,9 @@ if { [info procs saved-dg-test] == [list] } {
if [info exists compiler_conditional_xfail_data] { if [info exists compiler_conditional_xfail_data] {
unset compiler_conditional_xfail_data unset compiler_conditional_xfail_data
} }
if [info exists testname_with_flags] {
unset testname_with_flags
}
} }
} }
......
...@@ -265,8 +265,7 @@ proc run-gcov { args } { ...@@ -265,8 +265,7 @@ proc run-gcov { args } {
} }
} }
# Get the test name, including options that make it unique, from gnu-test 2 levels up. set testname [testname-for-summary]
upvar 2 name testname
# Extract the test file name from the arguments. # Extract the test file name from the arguments.
set testcase [lindex $gcov_args end] set testcase [lindex $gcov_args end]
......
...@@ -217,6 +217,7 @@ proc profopt-execute { src } { ...@@ -217,6 +217,7 @@ proc profopt-execute { src } {
global tool profile_option feedback_option prof_ext perf_ext perf_delta global tool profile_option feedback_option prof_ext perf_ext perf_delta
global generate_final_code use_final_code global generate_final_code use_final_code
global verbose global verbose
global testname_with_flags
if ![info exists profile_option] { if ![info exists profile_option] {
error "No profile option specified for first compile." error "No profile option specified for first compile."
...@@ -240,6 +241,12 @@ proc profopt-execute { src } { ...@@ -240,6 +241,12 @@ proc profopt-execute { src } {
set testcase "[file tail [file dirname $src]]/[file tail $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 executable $tmpdir/[file tail [file rootname $src].x]
set basename [file tail $testcase] set basename [file tail $testcase]
set base [file rootname $basename] set base [file rootname $basename]
...@@ -272,6 +279,7 @@ proc profopt-execute { src } { ...@@ -272,6 +279,7 @@ proc profopt-execute { src } {
set extra_flags [profopt-get-options $src] set extra_flags [profopt-get-options $src]
if { [lindex ${dg-do-what} 1 ] == "N" } { if { [lindex ${dg-do-what} 1 ] == "N" } {
unsupported "$src" unsupported "$src"
unset testname_with_flags
verbose "$src not supported on this target, skipping it" 3 verbose "$src not supported on this target, skipping it" 3
return return
} }
...@@ -437,4 +445,5 @@ proc profopt-execute { src } { ...@@ -437,4 +445,5 @@ proc profopt-execute { src } {
remote_file build delete $execname3 remote_file build delete $execname3
} }
} }
unset testname_with_flags
} }
...@@ -78,10 +78,7 @@ proc dg-scan { name positive testcase output_file orig_args } { ...@@ -78,10 +78,7 @@ proc dg-scan { name positive testcase output_file orig_args } {
# dg-scan for details. # dg-scan for details.
proc scan-assembler { args } { proc scan-assembler { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
dg-scan "scan-assembler" 1 $testcase $output_file $args dg-scan "scan-assembler" 1 $testcase $output_file $args
} }
...@@ -95,10 +92,7 @@ proc scan-assembler_required_options { args } { ...@@ -95,10 +92,7 @@ proc scan-assembler_required_options { args } {
# compiler. See dg-scan for details. # compiler. See dg-scan for details.
proc scan-assembler-not { args } { proc scan-assembler-not { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
dg-scan "scan-assembler-not" 0 $testcase $output_file $args dg-scan "scan-assembler-not" 0 $testcase $output_file $args
...@@ -128,10 +122,7 @@ proc hidden-scan-for { symbol } { ...@@ -128,10 +122,7 @@ proc hidden-scan-for { symbol } {
# produced by the compiler. # produced by the compiler.
proc scan-hidden { args } { proc scan-hidden { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0] set symbol [lindex $args 0]
...@@ -147,10 +138,7 @@ proc scan-hidden { args } { ...@@ -147,10 +138,7 @@ proc scan-hidden { args } {
# produced by the compiler. # produced by the compiler.
proc scan-not-hidden { args } { proc scan-not-hidden { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
set symbol [lindex $args 0] set symbol [lindex $args 0]
...@@ -164,10 +152,7 @@ proc scan-not-hidden { args } { ...@@ -164,10 +152,7 @@ proc scan-not-hidden { args } {
# Look for a pattern in OUTPUT_FILE. See dg-scan for details. # Look for a pattern in OUTPUT_FILE. See dg-scan for details.
proc scan-file { output_file args } { proc scan-file { output_file args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
dg-scan "scan-file" 1 $testcase $output_file $args dg-scan "scan-file" 1 $testcase $output_file $args
} }
...@@ -175,10 +160,7 @@ proc scan-file { output_file args } { ...@@ -175,10 +160,7 @@ proc scan-file { output_file args } {
# for details. # for details.
proc scan-file-not { output_file args } { proc scan-file-not { output_file args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
dg-scan "scan-file-not" 0 $testcase $output_file $args dg-scan "scan-file-not" 0 $testcase $output_file $args
} }
...@@ -186,10 +168,7 @@ proc scan-file-not { output_file args } { ...@@ -186,10 +168,7 @@ proc scan-file-not { output_file args } {
# dg-scan for details. # dg-scan for details.
proc scan-stack-usage { args } { proc scan-stack-usage { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].su" set output_file "[file rootname [file tail $testcase]].su"
dg-scan "scan-file" 1 $testcase $output_file $args dg-scan "scan-file" 1 $testcase $output_file $args
...@@ -199,10 +178,7 @@ proc scan-stack-usage { args } { ...@@ -199,10 +178,7 @@ proc scan-stack-usage { args } {
# compiler. See dg-scan for details. # compiler. See dg-scan for details.
proc scan-stack-usage-not { args } { proc scan-stack-usage-not { args } {
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set output_file "[file rootname [file tail $testcase]].su" set output_file "[file rootname [file tail $testcase]].su"
dg-scan "scan-file-not" 0 $testcase $output_file $args dg-scan "scan-file-not" 0 $testcase $output_file $args
...@@ -227,14 +203,7 @@ proc scan-assembler-times { args } { ...@@ -227,14 +203,7 @@ proc scan-assembler-times { args } {
} }
} }
# This assumes that we are two frames down from dg-test, and that set testcase [testname-for-summary]
# 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 pattern [lindex $args 0] set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern] set pp_pattern [make_pattern_printable $pattern]
...@@ -292,10 +261,7 @@ proc scan-assembler-dem { args } { ...@@ -292,10 +261,7 @@ proc scan-assembler-dem { args } {
verbose -log "c++filt is $cxxfilt" verbose -log "c++filt is $cxxfilt"
} }
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set pattern [lindex $args 0] set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern] set pp_pattern [make_pattern_printable $pattern]
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
...@@ -349,10 +315,7 @@ proc scan-assembler-dem-not { args } { ...@@ -349,10 +315,7 @@ proc scan-assembler-dem-not { args } {
verbose -log "c++filt is $cxxfilt" verbose -log "c++filt is $cxxfilt"
} }
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set pattern [lindex $args 0] set pattern [lindex $args 0]
set pp_pattern [make_pattern_printable $pattern] set pp_pattern [make_pattern_printable $pattern]
set output_file "[file rootname [file tail $testcase]].s" set output_file "[file rootname [file tail $testcase]].s"
...@@ -407,11 +370,7 @@ proc object-size { args } { ...@@ -407,11 +370,7 @@ proc object-size { args } {
verbose -log "size is $size" verbose -log "size is $size"
} }
upvar 2 name testcase set testcase [testname-for-summary]
if { [llength $testcase] > 1 } {
set testcase "$testcase "
}
set what [lindex $args 0] set what [lindex $args 0]
set where [lsearch { text data bss total } $what] set where [lsearch { text data bss total } $what]
if { $where == -1 } { if { $where == -1 } {
......
...@@ -45,10 +45,7 @@ proc scan-dump { args } { ...@@ -45,10 +45,7 @@ proc scan-dump { args } {
} }
} }
# This assumes that we are three frames down from dg-test, and that set testcase [testname-for-summary]
# 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 suf [dump-suffix [lindex $args 2]] set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\"" set testname "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
...@@ -88,11 +85,7 @@ proc scan-dump-times { args } { ...@@ -88,11 +85,7 @@ proc scan-dump-times { args } {
} }
} }
# This assumes that we are three frames down from dg-test, and that set testcase [testname-for-summary]
# 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 suf [dump-suffix [lindex $args 3]] set suf [dump-suffix [lindex $args 3]]
set printable_pattern [make_pattern_printable [lindex $args 1]] set printable_pattern [make_pattern_printable [lindex $args 1]]
set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"$printable_pattern\" [lindex $args 2]" set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"$printable_pattern\" [lindex $args 2]"
...@@ -132,11 +125,7 @@ proc scan-dump-not { args } { ...@@ -132,11 +125,7 @@ proc scan-dump-not { args } {
} }
} }
# This assumes that we are three frames down from dg-test, and that set testcase [testname-for-summary]
# 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 suf [dump-suffix [lindex $args 2]] set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\"" set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]] set src [file tail [lindex $testcase 0]]
...@@ -188,7 +177,7 @@ proc scan-dump-dem { args } { ...@@ -188,7 +177,7 @@ proc scan-dump-dem { args } {
verbose -log "c++filt is $cxxfilt" verbose -log "c++filt is $cxxfilt"
} }
upvar 3 name testcase set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]] set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\"" set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]] set src [file tail [lindex $testcase 0]]
...@@ -239,8 +228,7 @@ proc scan-dump-dem-not { args } { ...@@ -239,8 +228,7 @@ proc scan-dump-dem-not { args } {
verbose -log "c++filt is $cxxfilt" verbose -log "c++filt is $cxxfilt"
} }
upvar 3 name testcase set testcase [testname-for-summary]
set suf [dump-suffix [lindex $args 2]] set suf [dump-suffix [lindex $args 2]]
set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\"" set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
set src [file tail [lindex $testcase 0]] set src [file tail [lindex $testcase 0]]
......
...@@ -31,6 +31,34 @@ proc current_compiler_flags { } { ...@@ -31,6 +31,34 @@ proc current_compiler_flags { } {
return "$flags1 $flags2" 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. # If this target does not support weak symbols, skip this test.
proc dg-require-weak { args } { proc dg-require-weak { args } {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment