]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Support dg-additional-files in tests
authorJonathan Wakely <jwakely@redhat.com>
Wed, 13 Sep 2023 09:57:08 +0000 (10:57 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 14 Sep 2023 12:58:34 +0000 (13:58 +0100)
commit9da3c935e3f46e32d9f801f07916634dc9a65886
tree6f96fa15db115cc6a8d270195301187a1afca0fd
parentb9b9d0a7db098e2b7e6894dca98ddd551067cad1
libstdc++: Support dg-additional-files in tests

Some tests rely on text files with specific content being present in the
test directory.  This has historically been done by copying
testsuite/data/*.tst and testsuite/data/*.txt to the test dir at the
start, in the libstdc++_init procedure.  Some tests modify their data
files, so if the same test runs more than once in the same directory the
second and subsequent tests will see the modified files, and FAIL
because the content of the file is not in the expected state.

This change adds support for the dg-additional-files directive from the
main compiler testsuite and changes v3_target_compile to copy the
specified files to the directory where the test will run.  This ensures
that a fresh copy of the files is present each time the test runs.

Eventually all tests could be transitioned to use dg-additional-files
and then libstdc++_init could be changed to remove the initial copy of
all files.  This change only adds dg-additional-files to the tests that
modify their files and FAIL when re-run in the same directory.

The tests that rely on additional data files have comments containing
the strings "@require@" and "@diff@" which seem to be related to the
libstdc++-v3/mkcheck.in testing script that was removed in 2003.  Those
comments can be used to find tests that should be migrated to use the
new dg-additional-files support, and then the comments can be removed.

libstdc++-v3/ChangeLog:

* testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Use
dg-additional-files. Remove @require@ and @diff@ comments.
* testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc: Likewise.
* testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc: Likewise.
* testsuite/lib/dg-options.exp (v3_additional_files): New
global variable.
(dg-additional-files): New proc.
* testsuite/lib/libstdc++.exp (v3_target_compile): Copy
additional files to test directory.
libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc
libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc
libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc
libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc
libstdc++-v3/testsuite/lib/dg-options.exp
libstdc++-v3/testsuite/lib/libstdc++.exp