Hi,
<dominiq_> blindvt: BTW since you have looked at this piece of code, you
may give me some advice:
<dominiq_> on darwin* all the tests compiled with -g generate *.dSYM
folders. I'ld like to clean them.
Perhaps something like the attached? I find it a bit difficult to fit
that into the testsuite properly, so this is not a patch proposal.
Rainer, Mike, can you please advise on how we could do this properly?
TIA && cheers,
Not a patch!
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 4666ede..7c704fc 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -425,6 +425,36 @@ proc remove-build-file { pat } {
}
}
+# Remove files matching the pattern from the build machine.
+# Same as remove-build-file except that it can delete directories, too..
+# AFAICS this would need fixing in dejagnu which explicitly checks
+# isfile, pity.
+proc remove-build-dir { pat } {
+ rename standard_file saved-standard_file
+ proc standard_file { dest op args } {
+ set file [lindex $args 0]
+ verbose "dest in proc repaired-standard_file is $dest" 3
+ if { ![is_remote $dest] } {
+ if ![string compare $op "delete"] { # "deletedir" ?
+ file delete -force -- $args
+ }
+ } else {
+ saved-standard_file $dest $op $args
+ }
+ }
+ verbose "remove-build-dir `$pat'" 2
+ set file_list "[glob -nocomplain $pat]"
+ verbose "remove-build-dir `$file_list'" 2
+ foreach output_file $file_list {
+ if [is_remote host] {
+ # Ensure the host knows the file is gone by deleting there
+ # first.
+ remote_file host delete $output_file
+ }
+ remote_file build delete $output_file
+ }
+}
+
# Remove runtime-generated profile file for the current test.
proc cleanup-profile-file { } {
remove-build-file "mon.out"
diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp
index bb1763a..86996d4 100644
--- a/gcc/testsuite/lib/gcc.exp
+++ b/gcc/testsuite/lib/gcc.exp
@@ -127,7 +127,7 @@ proc gcc_target_compile { source dest type options } {
global GCC_UNDER_TEST
global TOOL_OPTIONS
global TEST_ALWAYS_FLAGS
-
+
if {[target_info needs_status_wrapper] != "" && \
[target_info needs_status_wrapper] != "0" && \
[info exists gluefile] } {
@@ -161,5 +161,20 @@ proc gcc_target_compile { source dest type options } {
lappend options "timeout=[timeout_value]"
lappend options "compiler=$GCC_UNDER_TEST"
set options [dg-additional-files-options $options $source]
+
+ if [istarget *-*-darwin*] {
+ # on darwin, files compiled with -g leave a .dSYM dir behind, nuke it
+ # ??? probably additional_clean_{dir,file}s or the like?
+ if {[lsearch -regexp $options "\[ \t=\]\-g"] >= 0} {
+ upvar 2 dg-final-code finalcode
+ if ![info exists finalcode] {
+ upvar 3 dg-final-code finalcode
+ }
+
+ set dsym "[file rootname [file tail $dest]].dSYM"
+ set finalcode [concat $finalcode "remove-build-dir $dsym{/\*,}\n"]
+ }
+ }
+
return [target_compile $source $dest $type $options]
}