public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 00/13] libstdc++: Add support for running tests with multiple -std options
Date: Tue, 12 Sep 2023 14:05:55 +0100	[thread overview]
Message-ID: <CACb0b4=-ag4800mGjrdWm+fHR77oTH6QVnPA5Pm-FqFdhhHxEQ@mail.gmail.com> (raw)
In-Reply-To: <20230911163534.1913512-1-jwakely@redhat.com>

On Mon, 11 Sept 2023 at 17:37, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> This patch series replicates the behaviour of the g++ testsuite, so that
> libstdc++ tests can easily be run for multiple different -std options in
> a single testsuite run.  As described in the updated docs, the -std
> options to use for every test can be overridden by setting v3_std_list
> in ~/.dejagnurc or $DEJAGNU, or setting $GLIBCXX_TESTSUITE_STDS in the
> environment.  If not overridden, the default is just to run with
> -std=gnu++17 (so that we don't increase the time taken for a full
> testsuite run).
>
> Tests that require a newer standard than C++17 will default to that
> newer standard and C++26, so e.g. std::format tests will be run with
> both -std=gnu++20 and -std=gnu++26.  This does increase the number of
> tests, but only for the subset of tests for C++20/23/26 features.  If
> this is too costly for testers, we can change that (this might be
> needed, because the C++20 tests for std::ranges and std::format are
> particularly slow to compile).
>
> Because a correct default will be chosen for tests that require
> something newer than C++17, we no longer need dg-options "-std=gnu++20"
> or similar in any tests.  Removing the explicit -std option allows the
> test to be run for later standards via the v3_std_list settings, so that
> we can verify that C++20 features still work in C++23 and C++26, for
> example.  This change already found some tests which failed when run
> with a later standard (see r14-3771-gf12e26f3496275).
>
> Patches 2-13 in the series remove those unnecessary dg-options from
> about half the relevant tests, but there are more than 500 others that
> still need adjusting.
>
> We can remove files like testsuite/std/format/functions/format_c++23.cc
> which only exist to duplicate existing tests with a different -std
> option.  We can remove that file now, and rely on format.cc being run
> with multiple -std options by libstdc++ maintainers.
>
> It might also be useful to add a 'make check-quick' target which runs a
> small subset of smoke tests with every standard version in v3_std_list.
> This would be a suitable target for CI bots and for packagers who want
> to verify that a build of GCC is functional, without running the entire
> libstdc++ testsuite.

There's a problem with this change. Some of our tests fail if they're
run more than once.

We have some static data files which are copied into the test
directory by libstdc++_init at the start of the run. But some tests
modify those files, so if the same test gets run multiple times, the
file is no longer in the expected state after the first test.

This only shows up when overriding the list of -std modes to include
more than one option. The tests pass on the first run, and fail for
subsequent ones:

Running /home/test/src/gcc/libstdc++-v3/testsuite/libstdc++-dg/conformance.exp
...
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++98 (test for
excess errors)
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++98 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++11 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++11 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++14 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++14 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++17 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++17 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++20 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++20 execution test
PASS: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++23 (test for
excess errors)
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc  -std=gnu++23 execution test

We either need to copy the data files again after each test, or
rewrite the tests to be idempotent.


  parent reply	other threads:[~2023-09-12 13:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 16:16 Jonathan Wakely
2023-09-11 16:16 ` [PATCH 01/13] " Jonathan Wakely
2023-09-11 16:16 ` [PATCH 02/13] libstdc++: Replace dg-options "-std=c++11" with dg-add-options strict_std Jonathan Wakely
2023-09-11 16:16 ` [PATCH 03/13] libstdc++: Replace dg-options "-std=c++17" " Jonathan Wakely
2023-09-11 16:16 ` [PATCH 04/13] libstdc++: Replace dg-options "-std=c++20" " Jonathan Wakely
2023-09-11 16:16 ` [PATCH 05/13] libstdc++: Remove dg-options "-std=c++20" from <span> and <cuchar> tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 06/13] libstdc++: Remove dg-options "-std=gnu++20" from <concepts> and <ranges> tests Jonathan Wakely
2023-09-15 20:54   ` [PATCH v2 6/13] " Jonathan Wakely
2023-09-11 16:16 ` [PATCH 07/13] libstdc++: Remove dg-options "-std=gnu++2a" from constrained algo tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 08/13] libstdc++: Remove dg-options "-std=gnu++20" from std::format tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 09/13] libstdc++: Remove dg-options "-std=gnu++20" from std::chrono tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 10/13] libstdc++: Remove dg-options "-std=gnu++23" from std::expected tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 11/13] libstdc++: Remove dg-options "-std=gnu++23" from remaining tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 12/13] libstdc++: Remove dg-options "-std=gnu++2a" from XFAIL std::span tests Jonathan Wakely
2023-09-11 16:16 ` [PATCH 13/13] libstdc++: Simplify dejagnu directives for some tests using threads Jonathan Wakely
2023-09-12 13:05 ` Jonathan Wakely [this message]
2023-09-12 13:39   ` [PATCH 14/13] libstdc++: Re-initialize static data files used by tests Jonathan Wakely
2023-09-15 23:04 ` [PATCH 00/13] libstdc++: Add support for running tests with multiple -std options Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACb0b4=-ag4800mGjrdWm+fHR77oTH6QVnPA5Pm-FqFdhhHxEQ@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).