[testsuite] : Really remove stack dump files

Message ID AANLkTi=EwqCbDS0BYcUPpzEVn=QfJr=nqsu9KTMVxu=z@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 20, 2010, 10:13 p.m.

Attached patch really removes .su files from test directory. The
problem with the call to cleanup-dump is, that it removes filenames
that include source file extension (.c, .cpp, .f90 or whatever) before
.su is appended. There is no appropriate function in the library, so
we have to open-code the function.

2010-09-21  Uros Bizjak  <ubizjak@gmail.com>

	* lib/gcc-dg.exp (clanup-stack-usage): Really remove .su files.

Patch was tested on x86_64-pc-linux-gnu, committed to mainline SVN.



Index: lib/gcc-dg.exp
--- lib/gcc-dg.exp	(revision 164444)
+++ lib/gcc-dg.exp	(working copy)
@@ -461,8 +461,21 @@ 
 # Remove a stack usage file for the current test.
-proc cleanup-stack-usage { args } {
-  cleanup-dump "su"
+proc cleanup-stack-usage { } {
+    # This assumes that we are two frames down from dg-test or some other proc
+    # that stores the filename of the testcase in a local variable "name".
+    # A cleaner solution would require a new DejaGnu release.
+    upvar 2 name testcase
+    # 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]].su"
+    # Clean up files for additional source files.
+    if [info exists additional_sources] {
+	foreach srcfile $additional_sources {
+	    remove-build-file "[file rootname [file tail $srcfile]].su"
+	}
+    }
 # Remove all dump files with the provided suffix.