diff mbox

[PR65126,testsuite] Add additional_sources_used

Message ID 54EAD555.5000905@mentor.com
State New
Headers show

Commit Message

Tom de Vries Feb. 23, 2015, 7:23 a.m. UTC
Hi,

This patch fixes PR65126, which is about the fact that the cleanup procs are not 
cleaning up files generated from additional_sources. This happens because 
dg-additional-files-options empties additional_sources before the cleanup procs 
can use it.

Examples of leftover files because of this PR are:
- vect-simd-clone-10a.c.126t.vect
- pr47218-1.o, pr47218-1.ii, pr47218-1.s

The patch introduces a variable additional_sources_used, which is set by 
dg-additional-files-options before it empties additional_sources.  The cleanup 
procs are modified to use additional_sources_used.

With this patch, after running test I no longer find the leftover files in the 
test directories.

Build and reg-tested on x86_64. OK for stage4?

Thanks,
- Tom

Comments

Jeff Law Feb. 23, 2015, 9:56 p.m. UTC | #1
On 02/23/15 00:23, Tom de Vries wrote:
> Hi,
>
> This patch fixes PR65126, which is about the fact that the cleanup procs
> are not cleaning up files generated from additional_sources. This
> happens because dg-additional-files-options empties additional_sources
> before the cleanup procs can use it.
>
> Examples of leftover files because of this PR are:
> - vect-simd-clone-10a.c.126t.vect
> - pr47218-1.o, pr47218-1.ii, pr47218-1.s
>
> The patch introduces a variable additional_sources_used, which is set by
> dg-additional-files-options before it empties additional_sources.  The
> cleanup procs are modified to use additional_sources_used.
>
> With this patch, after running test I no longer find the leftover files
> in the test directories.
>
> Build and reg-tested on x86_64. OK for stage4?
>
> Thanks,
> - Tom
>
> 0001-Add-additional_sources_used.patch
>
>
> 2015-02-22  Tom de Vries<tom@codesourcery.com>
>
> 	* lib/gcc-defs.exp (additional_sources_used): Add new var.
> 	(dg-additional-files-options): Copy additional_sources to
> 	additional_sources_used before emptying additional_sources.
> 	* lib/gcc-dg.exp (cleanup-coverage-files, cleanup-repo-files)
> 	(cleanup-stack-usage, cleanup-ada-spec, cleanup-dump)
> 	(cleanup-saved-temps): Use additional_sources_used instead of
> 	additional_sources.
> 	(dg-test): Reset additional_sources_used.
OK.

Jeff
diff mbox

Patch

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

	* lib/gcc-defs.exp (additional_sources_used): Add new var.
	(dg-additional-files-options): Copy additional_sources to
	additional_sources_used before emptying additional_sources.
	* lib/gcc-dg.exp (cleanup-coverage-files, cleanup-repo-files)
	(cleanup-stack-usage, cleanup-ada-spec, cleanup-dump)
	(cleanup-saved-temps): Use additional_sources_used instead of
	additional_sources.
	(dg-test): Reset additional_sources_used.
---
 gcc/testsuite/lib/gcc-defs.exp |  3 +++
 gcc/testsuite/lib/gcc-dg.exp   | 32 +++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index 6f6e719..a30b176 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -268,6 +268,7 @@  proc dg-additional-options { args } {
 # main source file.
 
 set additional_sources ""
+set additional_sources_used ""
 
 proc dg-additional-sources { args } {
     global additional_sources
@@ -290,6 +291,7 @@  proc dg-additional-files { args } {
 
 proc dg-additional-files-options { options source } {
     global additional_sources
+    global additional_sources_used
     global additional_files
     set to_download [list]
     if { $additional_sources != "" } then {
@@ -301,6 +303,7 @@  proc dg-additional-files-options { options source } {
 	    lappend options "additional_flags=$additional_sources"
 	}
 	set to_download [concat $to_download $additional_sources]
+	set additional_sources_used "$additional_sources"
 	set additional_sources ""
     }
     if { $additional_files != "" } then { 
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 443e8ed..5a9102e 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -495,14 +495,15 @@  proc cleanup-profile-file { } {
 
 # Remove compiler-generated coverage files for the current test.
 proc cleanup-coverage-files { } {
+    global additional_sources_used
     set testcase [testname-for-summary]
     # The name might include a list of options; extract the file name.
     set testcase [lindex $testcase 0]
     remove-build-file "[file rootname [file tail $testcase]].gc??"
 
     # Clean up coverage files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    remove-build-file "[file rootname [file tail $srcfile]].gc??"
 	}
     }
@@ -510,6 +511,7 @@  proc cleanup-coverage-files { } {
 
 # Remove compiler-generated files from -repo for the current test.
 proc cleanup-repo-files { } {
+    global additional_sources_used
     set testcase [testname-for-summary]
     # The name might include a list of options; extract the file name.
     set testcase [lindex $testcase 0]
@@ -517,8 +519,8 @@  proc cleanup-repo-files { } {
     remove-build-file "[file rootname [file tail $testcase]].rpo"
 
     # Clean up files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    remove-build-file "[file rootname [file tail $srcfile]].o"
 	    remove-build-file "[file rootname [file tail $srcfile]].rpo"
 	}
@@ -554,8 +556,8 @@  proc cleanup-stack-usage { } {
     remove-build-file "[file rootname [file tail $testcase]].su"
 
     # Clean up files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    remove-build-file "[file rootname [file tail $srcfile]].su"
 	}
     }
@@ -563,12 +565,13 @@  proc cleanup-stack-usage { } {
 
 # Remove an Ada spec file for the current test.
 proc cleanup-ada-spec { } {
+    global additional_sources_used
     set testcase [testname-for-summary]
     remove-build-file "[get_ada_spec_filename $testcase]"
 
     # Clean up files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    remove-build-file "[get_ada_spec_filename $srcfile]"
 	}
     }
@@ -576,6 +579,7 @@  proc cleanup-ada-spec { } {
 
 # Remove all dump files with the provided suffix.
 proc cleanup-dump { suffix } {
+    global additional_sources_used
     set testcase [testname-for-summary]
     # The name might include a list of options; extract the file name.
     set src [file tail [lindex $testcase 0]]
@@ -586,8 +590,8 @@  proc cleanup-dump { suffix } {
     remove-build-file "[file tail $src].gk.$suffix"
 
     # Clean up dump files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    remove-build-file "[file tail $srcfile].$suffix"
 	    remove-build-file "[file rootname [file tail $srcfile]].exe.$suffix"
 	    remove-build-file "[file rootname [file tail $srcfile]].exe.ltrans\[0-9\]*.$suffix"
@@ -603,7 +607,7 @@  proc cleanup-dump { suffix } {
 # if there are tests generating them.
 # ARGS is a list of suffixes to NOT delete.
 proc cleanup-saved-temps { args } {
-    global additional_sources
+    global additional_sources_used
     set suffixes {}
 
     # add the to-be-kept suffixes
@@ -625,8 +629,8 @@  proc cleanup-saved-temps { args } {
     }
 
     # Clean up saved temp files for additional source files.
-    if [info exists additional_sources] {
-	foreach srcfile $additional_sources {
+    if [info exists additional_sources_used] {
+	foreach srcfile $additional_sources_used {
 	    foreach suffix $suffixes {
 		remove-build-file "[file rootname [file tail $srcfile]]$suffix"
 		remove-build-file "[file rootname [file tail $srcfile]].exe$suffix"
@@ -746,6 +750,7 @@  if { [info procs saved-dg-test] == [list] } {
 	    set saved_info $errorInfo
 	    set additional_files ""
 	    set additional_sources ""
+	    set additional_sources_used ""
 	    set additional_prunes ""
 	    set shouldfail 0
 	    if [info exists compiler_conditional_xfail_data] {
@@ -759,6 +764,7 @@  if { [info procs saved-dg-test] == [list] } {
 	}
 	set additional_files ""
 	set additional_sources ""
+	set additional_sources_used ""
 	set additional_prunes ""
 	set shouldfail 0
 	if [info exists set_target_env_var] {
-- 
1.9.1