* more general multi-file testing support for FDO
@ 2011-05-01 17:34 Xinliang David Li
0 siblings, 0 replies; only message in thread
From: Xinliang David Li @ 2011-05-01 17:34 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 435 bytes --]
I need this support for LIPO but it might be also useful for trunk.
The support is 'borrowed' from lib/lto.exp. I have tested with it and
it works fine. The only limitation is for any subdirectory with a
multi-source test case, all the other single source test case need
also to follow the same naming standard, i.e., named as xxxx_0.c. The
current FDO test under gcc.dg/tree-prof works as it is without any
changes.
Thanks,
David
[-- Attachment #2: prof-multi.p --]
[-- Type: application/octet-stream, Size: 4189 bytes --]
Index: testsuite/lib/profopt.exp
===================================================================
--- testsuite/lib/profopt.exp (revision 173148)
+++ testsuite/lib/profopt.exp (working copy)
@@ -239,6 +239,27 @@ proc profopt-execute { src } {
set executable $tmpdir/[file tail [file rootname $src].x]
set basename [file tail $testcase]
set base [file rootname $basename]
+ set dir [file dirname $src]
+ # multiple file test base
+ set mbase [file rootname $basename]
+ regsub "_0" $mbase "" mbase
+ regsub "/" $mbase "" mbase
+ set src_list $src
+ set i 1
+ set done 0
+ while { !$done } {
+ set names [glob -nocomplain -types f -- "${dir}/${mbase}_${i}.*"]
+ if { [llength ${names}] > 1 } {
+ warning "profopt-execute: more than one file matched ${dir}/${mbase}_${i}.*"
+ }
+ if { [llength ${names}] == 1 } {
+ lappend src_list [lindex ${names} 0]
+ incr i
+ } else {
+ set num_srcs ${i}
+ set done 1
+ }
+ }
set count 0
foreach option $prof_option_list {
@@ -279,7 +300,8 @@ proc profopt-execute { src } {
set options "$extra_options"
lappend options "additional_flags=$option $extra_flags $profile_option"
set optstr "$option $profile_option"
- set comp_output [${tool}_target_compile "$src" "$execname1" executable $options]
+ verbose "Hey $src_list $execname1 executable $options"
+ set comp_output [${tool}_target_compile "$src_list" "$execname1" executable $options]
if ![${tool}_check_compile "$testcase compilation" $optstr $execname1 $comp_output] {
unresolved "$testcase execution, $optstr"
unresolved "$testcase compilation, $option $feedback_option"
@@ -294,15 +316,32 @@ proc profopt-execute { src } {
set missing_file 0
# Make sure the profile data was generated, and fail if not.
if { $status == "pass" } {
- foreach ext $prof_ext {
- remote_upload target $tmpdir/$base.$ext
- set files [glob -nocomplain $base.$ext]
- if { $files == "" } {
- set status "fail"
- set missing_file 1
- fail "$testcase execution: file $base.$ext does not exist, $option $profile_option"
- }
- }
+ set i 0
+ if { $num_srcs > 1 } {
+ foreach s $src_list {
+ foreach ext $prof_ext {
+ remote_upload target $tmpdir/${mbase}_${i}.$ext
+ set files [glob -nocomplain ${mbase}_${i}.$ext]
+ if { $files == "" } {
+ set status "fail"
+ set missing_file 1
+ fail "$testcase execution: file ${mbase}_${i}.$ext does not exist, $option $profile_option"
+ }
+ }
+ incr i
+ }
+ } else {
+ foreach ext $prof_ext {
+ remote_upload target $tmpdir/$base.$ext
+ set files [glob -nocomplain $base.$ext]
+ if { $files == "" } {
+ set status "fail"
+ set missing_file 1
+ fail "$testcase execution: file $base.$ext does not exist, $option $profile_option"
+ }
+ }
+ }
+
}
if { $missing_file == 0 } {
$status "$testcase execution, $optstr"
@@ -328,7 +367,7 @@ proc profopt-execute { src } {
set options "$extra_options"
lappend options "additional_flags=$option $extra_flags $feedback_option"
set optstr "$option $feedback_option"
- set comp_output [${tool}_target_compile "$src" "$execname2" "executable" $options]
+ set comp_output [${tool}_target_compile "$src_list" "$execname2" "executable" $options]
# Prune warnings we know are unwanted.
set comp_output [prune_warnings $comp_output]
@@ -379,7 +418,7 @@ proc profopt-execute { src } {
set options "$extra_options"
lappend options "additional_flags=$option"
set optstr "$option"
- set comp_output [${tool}_target_compile "$src" "$execname3" "executable" $options]
+ set comp_output [${tool}_target_compile "$src_list" "$execname3" "executable" $options]
if ![${tool}_check_compile "$testcase compilation" $optstr $execname3 $comp_output] {
unresolved "$testcase execution, $optstr"
unresolved "$testcase perf check, $optstr"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-01 17:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-01 17:34 more general multi-file testing support for FDO Xinliang David Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).