-# Copyright (C) 2001 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# addition to the profiling and feedback options.
# If perf_ext is defined and the performance value for the
-# profile-directed test run is non-zero then the performance check will
+# profile-directed test run is nonzero then the performance check will
# be done.
global PROFOPT_OPTIONS perf_delta
if ![info exists tool] {
error "Tools is not specified."
}
-if ![info exists profile_option] {
- error "No profile option specified for first compile."
-}
-if ![info exists feedback_option] {
- error "No feedback option specified for second compile."
-}
if ![info exists prof_ext] {
error "No profile data file extension specified."
}
{ -Os } ]
}
-set option_list $PROFOPT_OPTIONS
+set prof_option_list $PROFOPT_OPTIONS
#
# profopt-cleanup -- remove profiling or performance results files.
#
-# EXT is the extension of files to remove
+# TESTCASE is the name of the test
+# EXT is the extension of file to remove
#
-proc profopt-cleanup { ext } {
- set files [glob -nocomplain *.$ext]
+proc profopt-cleanup { testcase ext } {
+ set basename [file tail $testcase]
+ set base [file rootname $basename]
+ set files [glob -nocomplain $base.$ext]
if { $files != "" } {
eval "remote_file build delete $files"
}
fail "$testcase perf check: file $base.$perf_ext has wrong format, $optstr"
}
close $fd
- profopt-cleanup $perf_ext
+ profopt-cleanup $testcase $perf_ext
return $val
}
#
proc profopt-execute { src } {
global srcdir tmpdir
- global option_list
+ global prof_option_list
global tool profile_option feedback_option prof_ext perf_ext perf_delta
global verbose
+ if ![info exists profile_option] {
+ error "No profile option specified for first compile."
+ }
+ if ![info exists feedback_option] {
+ error "No feedback option specified for second compile."
+ }
+
regsub "^$srcdir/?" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
set executable $tmpdir/[file tail [file rootname $src].x]
set count 0
- foreach option $option_list {
+ foreach option $prof_option_list {
set execname1 "${executable}${count}1"
set execname2 "${executable}${count}2"
set execname3 "${executable}${count}3"
remote_file build delete $execname3
verbose "Testing $testcase, $option" 1
+ # Remove old profiling and performance data files.
+ profopt-cleanup $testcase $prof_ext
+ if [info exists perf_ext] {
+ profopt-cleanup $testcase $perf_ext
+ }
+
# Compile for profiling.
set options ""
}
# Remove the profiling data files.
- profopt-cleanup $prof_ext
+ profopt-cleanup $testcase $prof_ext
# If the test is not expected to produce performance data then
# we're done now.