mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
3a0e01f6bb
This copies the code from the compiler's gcc/testsuite/lib/g++-dg.exp so that each test can be run multiple times, with different -std options. This means that we can remove most { dg-options "-std=gnu++20" } directives from tests, because the testsuite will automatically select a set of -std options that includes that version. Tests that should only run for a specific standard (e.g. ones that use something like { dg-do run { target c++11_only } }) should still specify that standard with { dg-options "-std=gnu++11" }, which overrides the automatic selection. But a dg-options that selects a newer standard than the default can be removed, because that standard will be selected automatically based on a selector like { target c++20 } in the dg-do directive. This will allow those tests to be run for more than just the one they currently hardcode, so that e.g. std::format tests can be run for all of C++20, C++23 and C++26. Currently that has to be done by adding a second test file that uses a different dg-options line. By default most tests will continue to run with only the default dialect (currently -std=gnu++17) so that the time to run the entire testsuite is not increased. We can revisit this later if increasing the testsuite time (and coverage) is acceptable. Libstdc++ developers can easily override the defaults to run for multiple versions. To test all versions, either add 'set v3_std_list { 98 11 14 17 20 23 26 }' to ~/.dejagnurc or define GLIBCXX_TESTSUITE_STDS="98,11,14,17,20,23,26" in the environment. This should be more efficient than the current way to test with multple standards, i.e. --target_board=unix{-std=c++14,-std=c++17,-std=c++20}, because today all tests with an explicit -std option hardcoded in them get run for each target board variation but using the exact same hardcoded -std every time. With the new approach you can just use the default --target_board=unix and set GLIBCXX_TESTSUITE_STDS="14,17,20" and now a test that has { target c++20 } will only run once (and be UNSUPPORTED twice), instead of running with identical options three times. In order to support ~/.dejagnurc and $DEJAGNU files that need to work with versions of GCC without this change, a new variable is added to site.tmp to detect whether v3_std_list is supported. That allows e.g. if { [info exists v3-use-std-list] } { set v3_std_list { 11 17 23 } set target_list { "unix{,-m32}" } } else { set target_list { "unix{,-std=gnu++2b,-std=gnu++11,-m32}" } } libstdc++-v3/ChangeLog: * doc/xml/manual/test.xml: Update documentation on running and writing tests. * doc/html/manual/test.html: Regenerate. * testsuite/Makefile.am: Add v3-use-std-list to site.tmp * testsuite/Makefile.in: Regenerate. * testsuite/lib/dg-options.exp (add_options_for_strict_std): New proc. * testsuite/lib/libstdc++.exp (search_for): New utility proc. (v3-dg-runtest): New proc to replace dg-runtest. * testsuite/libstdc++-dg/conformance.exp: Use v3-dg-runtest. |
||
---|---|---|
.. | ||
doxygen | ||
html | ||
xml | ||
xsl | ||
Makefile.am | ||
Makefile.in |