diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-25 10:20:01 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-25 10:20:01 +0200 |
| commit | 4f89a02e03b056d0c55108a8c9194126ef4ee811 (patch) | |
| tree | 0d41c79a08afc69af2184ee77591ecc28eb592fa /gcc/testlib/elna-dg.exp | |
| parent | 1e0f89df48ba10cdde80bd623b84e20fb48b977d (diff) | |
| download | elna-4f89a02e03b056d0c55108a8c9194126ef4ee811.tar.gz | |
Fix repeat loop scoping
Diffstat (limited to 'gcc/testlib/elna-dg.exp')
| -rw-r--r-- | gcc/testlib/elna-dg.exp | 15 |
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 |
