@@ -102,6 +102,12 @@ proc v3-copy-files {srcfiles} {
}
}
+proc v3-init-data-files { } {
+ global srcdir
+ v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
+ v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
+}
+
# Called once, during runtest.exp setup.
proc libstdc++_init { testfile } {
global env
@@ -159,8 +165,7 @@ proc libstdc++_init { testfile } {
set dg-do-what-default run
# Copy any required data files.
- v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
- v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
+ v3-init-data-files
set ld_library_path_tmp ""
@@ -556,11 +561,26 @@ proc v3-dg-runtest { testcases flags default-extra-flags } {
set option_list { "" }
}
+ # Some tests (e.g. 27_io/basic_filebuf/seek{off,pos}/char/[12]-io.cc)
+ # rely on text files with specific data being present in the test dir.
+ # Because the tests modify those files, running the same test a second
+ # time will FAIL due to the files not being in their initial state.
+ # We rely on the fact that those files contain a "@require@" comment
+ # to trigger creating fresh copies of the files for repeated tests.
+ if [search_for $test "@require@"] {
+ set need_fresh_data_files [llength $option_list]
+ } else {
+ set need_fresh_data_files 0
+ }
+
set nshort [file tail [file dirname $test]]/[file tail $test]
foreach flags_t $option_list {
verbose "Testing $nshort, $flags $flags_t" 1
dg-test $test "$flags $flags_t" ${default-extra-flags}
+ if { $need_fresh_data_files > 1 } {
+ v3-init-data-files
+ }
}
}
}