Line 212... |
Line 212... |
#
|
#
|
# SRC is the full pathname of the testcase.
|
# SRC is the full pathname of the testcase.
|
#
|
#
|
proc profopt-execute { src } {
|
proc profopt-execute { src } {
|
global srcdir tmpdir
|
global srcdir tmpdir
|
global prof_option_list
|
global prof_option_list additional_sources
|
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
|
|
|
if ![info exists profile_option] {
|
if ![info exists profile_option] {
|
Line 268... |
Line 268... |
if { [lindex ${dg-do-what} 1 ] == "N" } {
|
if { [lindex ${dg-do-what} 1 ] == "N" } {
|
unsupported "$src"
|
unsupported "$src"
|
verbose "$src not supported on this target, skipping it" 3
|
verbose "$src not supported on this target, skipping it" 3
|
return
|
return
|
}
|
}
|
|
# $additional_sources is cleared by dg-additional-files-options,
|
|
# thus we must save the information from there now in order to
|
|
# be able to delete / upload the associated profiling result files.
|
|
set sources $base
|
|
foreach source "$additional_sources" {
|
|
set source [file tail $source]
|
|
set source [file rootname $source]
|
|
lappend sources $source
|
|
# Remove old profiling and performance data files.
|
|
foreach ext $prof_ext {
|
|
remote_file target delete $tmpdir/$source.$ext
|
|
}
|
|
}
|
|
|
set extra_options [dg-additional-files-options "" "$src"]
|
set extra_options [dg-additional-files-options "" "$src"]
|
|
|
# Compile for profiling.
|
# Compile for profiling.
|
|
|
set options "$extra_options"
|
set options "$extra_options"
|
lappend options "additional_flags=$option $extra_flags $profile_option"
|
lappend options "additional_flags=$option $extra_flags $profile_option"
|
set optstr "$option $profile_option"
|
# for remote targets, having an absolute profile dir from the host
|
|
# causes grief.
|
|
set optstr "$option $profile_option -fprofile-dir=."
|
set comp_output [${tool}_target_compile "$src" "$execname1" executable $options]
|
set comp_output [${tool}_target_compile "$src" "$execname1" executable $options]
|
if ![${tool}_check_compile "$testcase compilation" $optstr $execname1 $comp_output] {
|
if ![${tool}_check_compile "$testcase compilation" $optstr $execname1 $comp_output] {
|
unresolved "$testcase execution, $optstr"
|
unresolved "$testcase execution, $optstr"
|
unresolved "$testcase compilation, $option $feedback_option"
|
unresolved "$testcase compilation, $option $feedback_option"
|
unresolved "$testcase execution, $option $feedback_option"
|
unresolved "$testcase execution, $option $feedback_option"
|
Line 292... |
Line 307... |
set status [lindex $result 0]
|
set status [lindex $result 0]
|
set missing_file 0
|
set missing_file 0
|
# Make sure the profile data was generated, and fail if not.
|
# Make sure the profile data was generated, and fail if not.
|
if { $status == "pass" } {
|
if { $status == "pass" } {
|
foreach ext $prof_ext {
|
foreach ext $prof_ext {
|
remote_upload target $tmpdir/$base.$ext
|
foreach source "$sources" {
|
set files [glob -nocomplain $base.$ext]
|
remote_upload target $tmpdir/$source.$ext
|
|
set files [glob -nocomplain $source.$ext]
|
if { $files == "" } {
|
if { $files == "" } {
|
set status "fail"
|
set status "fail"
|
set missing_file 1
|
set missing_file 1
|
fail "$testcase execution: file $base.$ext does not exist, $option $profile_option"
|
fail "$testcase execution: file $source.$ext does not exist, $option $profile_option"
|
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
if { $missing_file == 0 } {
|
if { $missing_file == 0 } {
|
$status "$testcase execution, $optstr"
|
$status "$testcase execution, $optstr"
|
Line 344... |
Line 361... |
profopt-final-code "use" $use_final_code $testcase
|
profopt-final-code "use" $use_final_code $testcase
|
}
|
}
|
|
|
# Remove the profiling data files.
|
# Remove the profiling data files.
|
foreach ext $prof_ext {
|
foreach ext $prof_ext {
|
remote_file target delete $tmpdir/$base.$ext
|
foreach source "$sources" {
|
|
remote_file target delete $tmpdir/$source.$ext
|
|
}
|
}
|
}
|
|
|
if { $status != "pass" } {
|
if { $status != "pass" } {
|
continue
|
continue
|
}
|
}
|