public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, testsuite] Add profopt-target-cleanup
@ 2015-02-26 15:09 Tom de Vries
  2015-02-26 18:15 ` Mike Stump
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2015-02-26 15:09 UTC (permalink / raw)
  To: GCC Patches, Mike Stump

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

Hi,

this patch adds proc profopt-target-cleanup, which cleans up profile files, 
while also taking dg-additional-sources into account.

Using profopt-target-cleanup in profopt-execute, we cleanup f.i. 
ic-misattribution-1a.gcda after running the tree-prof/ic-misattribution-1.c 
testcase.

OK for stage4 trunk?

Thanks,
- Tom


[-- Attachment #2: 0002-Add-profopt-target-cleanup.patch --]
[-- Type: text/x-patch, Size: 2530 bytes --]

2015-02-26  Tom de Vries  <tom@codesourcery.com>

	* lib/profopt.exp (profopt-target-cleanup): New proc.
	(profopt-execute): Use profopt-target-cleanup to handle cleanup of
	files from sources from dg-additional-sources.

---
 gcc/testsuite/lib/profopt.exp | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp
index 6c01a87..027ae9d 100644
--- a/gcc/testsuite/lib/profopt.exp
+++ b/gcc/testsuite/lib/profopt.exp
@@ -81,6 +81,30 @@ proc profopt-cleanup { testcase extlist } {
 }
 
 #
+# profopt-target-cleanup -- remove profiling result files.
+#
+# DIR is the name of the directory
+# TESTCASE is the name of the test
+# EXT is the extensions of files to remove
+#
+proc profopt-target-cleanup { dir testcase ext } {
+    global additional_sources_used
+    set basename [file tail $testcase]
+    set base [file rootname $basename]
+    set file "$dir/$base.$ext"
+    eval "remote_file target delete $file"
+
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
+	    set basename [file tail $srcfile]
+	    set base [file rootname $basename]
+	    set file "$dir/$base.$ext"
+	    eval "remote_file target delete $file"
+	}
+    }
+}
+
+#
 # profopt-perf-value -- get performance value for a test
 #
 # TESTCASE is the name of the test
@@ -262,10 +286,7 @@ proc profopt-execute { src } {
 	remote_file build delete $execname3
 	verbose "Testing $testcase, $option" 1
 
-	# Remove old profiling and performance data files.
-	foreach ext $prof_ext {
-	    remote_file target delete $tmpdir/$base.$ext
-	}
+	# Remove old performance data files.
 	if [info exists perf_ext] {
 	    profopt-cleanup $testcase $perf_ext
 	}
@@ -285,6 +306,12 @@ proc profopt-execute { src } {
 
         set extra_options [dg-additional-files-options "" "$src"]
 
+	# Remove old profiling data files.  Make sure additional_sources_used is
+	# valid, by running it after dg-additional-files-options.
+	foreach ext $prof_ext {
+	    profopt-target-cleanup $tmpdir $base $ext
+	}
+
 	# Tree profiling requires TLS runtime support, which may need
 	# additional flags.
 	if { [string first "-fprofile-generate" $profile_option] >= 0 } {
@@ -368,7 +395,7 @@ proc profopt-execute { src } {
 
 	# Remove the profiling data files.
 	foreach ext $prof_ext {
-	    remote_file target delete $tmpdir/$base.$ext
+	    profopt-target-cleanup $tmpdir $base $ext
 	}
 
 	if { $status != "pass" } {
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, testsuite] Add profopt-target-cleanup
  2015-02-26 15:09 [patch, testsuite] Add profopt-target-cleanup Tom de Vries
@ 2015-02-26 18:15 ` Mike Stump
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Stump @ 2015-02-26 18:15 UTC (permalink / raw)
  To: Tom de Vries; +Cc: GCC Patches

On Feb 26, 2015, at 7:04 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> this patch adds proc profopt-target-cleanup, which cleans up profile files, while also taking dg-additional-sources into account.
> 
> Using profopt-target-cleanup in profopt-execute, we cleanup f.i. ic-misattribution-1a.gcda after running the tree-prof/ic-misattribution-1.c testcase.
> 
> OK for stage4 trunk?

Ok.  Just watch for any issues or cross issues...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-26 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 15:09 [patch, testsuite] Add profopt-target-cleanup Tom de Vries
2015-02-26 18:15 ` Mike Stump

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).