aboutsummaryrefslogtreecommitdiff
path: root/gcc/testlib
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testlib')
-rw-r--r--gcc/testlib/elna-dg.exp15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/testlib/elna-dg.exp b/gcc/testlib/elna-dg.exp
index 93c7762..03620e3 100644
--- a/gcc/testlib/elna-dg.exp
+++ b/gcc/testlib/elna-dg.exp
@@ -88,13 +88,25 @@ proc elna-convert-directive { line_var directive dg_name } {
# base - absolute path to the source directory, e.g. .../testsuite/elna.dg
# test - relative path from testsuite, e.g. fail_compilation/file_name.elna
#
+#
+# Creates a directory at $path, handling the case where a regular
+# file already exists at that location (leftover from a prior
+# interrupted run).
+#
+proc elna-ensure-dir { path } {
+ if { [file exists $path] && ![file isdirectory $path] } {
+ file delete $path
+ }
+ file mkdir $path
+}
+
proc elna-convert-test { base test { extra_lines "" } } {
set type [file dirname $test]
set target $test
# Opens a file in the build directory for writing and the source
# file for reading.
- file mkdir $type
+ elna-ensure-dir $type
set fin [open $base/$target r]
set fout [open $target w]
@@ -178,6 +190,7 @@ proc elna-handle-multimodule { base test } {
# Build extra directives: -I for imports and dg-additional-sources.
set extra_lines ""
lappend extra_lines "(* { dg-additional-options \"-I$dir\" } *)"
+ elna-ensure-dir $test
foreach src $extra_sources {
set src_rel [string range $src [expr {[string length $dir] + 1}] end]
file copy $src $test