On Sat, 28 Dec 2024, 07:01 Hans-Peter Nilsson, <h...@bitrange.com> wrote:

> I can't think of a straightforward way to prune these two
> similar tests to a more meaningful subset: there's no easy
> pruning to each Nth iteration instead of every iteration.
> Hopefully exiting the loop after a million runs at the
> beginning of the tested range of dates, will catch the gist
> of the test.  I think I can interpret Jeffs pre-approval at
> https://gcc.gnu.org/pipermail/gcc-patches/2024-December/672218.html
> to cover this change too, but IMHO this one is less obvious
> than that change, so I'll wait until 2024-01-11, before
> defaulting to committing it, in case of no comments.
>
> Having said that: ok to commit?
>

I wonder if it would make sense to also change the starting date for
stimulators, so that instead of 100,000 iterations from a very negative
date to a slightly less negative date, we have simulators start iterating
from days(-50000).



> -- >8 --
> These two long-running tests happened to fail for me when
> run in parallel (nprocs - 1) compared to a serial run, for
> target mmix on my laptop.  The runtime is 3m40s for 3.cc
> before this change, and 0.9s afterwards.
>
>         * testsuite/std/time/year_month_day/3.cc [ITERATIONS] (test01):
> Limit
>         the number of tested dates to ITERATIONS.  Pass -DITERATIONS=100000
>         for simulators.
>         * testsuite/std/time/year_month_day/4.cc: Ditto.
> ---
>  libstdc++-v3/testsuite/std/time/year_month_day/3.cc | 8 ++++++++
>  libstdc++-v3/testsuite/std/time/year_month_day/4.cc | 8 ++++++++
>  2 files changed, 16 insertions(+)
>
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_day/3.cc
> b/libstdc++-v3/testsuite/std/time/year_month_day/3.cc
> index 05dc750c0a09..e98927335e53 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_day/3.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_day/3.cc
> @@ -1,4 +1,5 @@
>  // { dg-do run { target c++20 } }
> +// { dg-additional-options "-DITERATIONS=100000" { target simulator } }
>
>  // Copyright (C) 2021-2024 Free Software Foundation, Inc.
>  //
> @@ -54,7 +55,14 @@ void test01()
>
>    auto n   = days{-12687428};
>    auto ymd = -32767y/January/1d;
> +#ifdef ITERATIONS
> +  int iteration = 0;
> +#endif
>    while (n < days{11248737}) {
> +#ifdef ITERATIONS
> +    if (iteration++ == ITERATIONS)
> +      break;
> +#endif
>      VERIFY( year_month_day{sys_days{n}} == ymd );
>      ++n;
>      advance(ymd);
> diff --git a/libstdc++-v3/testsuite/std/time/year_month_day/4.cc
> b/libstdc++-v3/testsuite/std/time/year_month_day/4.cc
> index 6b6714e3a85e..a8a90f767ad7 100644
> --- a/libstdc++-v3/testsuite/std/time/year_month_day/4.cc
> +++ b/libstdc++-v3/testsuite/std/time/year_month_day/4.cc
> @@ -1,4 +1,5 @@
>  // { dg-do run { target c++20 } }
> +// { dg-additional-options "-DITERATIONS=100000" { target simulator } }
>
>  // Copyright (C) 2021-2024 Free Software Foundation, Inc.
>  //
> @@ -54,7 +55,14 @@ void test01()
>
>    auto n   = days{-12687428};
>    auto ymd = -32767y/January/1d;
> +#ifdef ITERATIONS
> +  int iteration = 0;
> +#endif
>    while (ymd < 32767y/December/31d) {
> +#ifdef ITERATIONS
> +    if (iteration++ == ITERATIONS)
> +      break;
> +#endif
>      VERIFY( static_cast<sys_days>(ymd) == sys_days{n} );
>      ++n;
>      advance(ymd);
> --
> 2.39.2
>
>

Reply via email to