libstdc++-v3/testsuite/.../year_month_day/3.cc, 4.cc: Cut down for simulators

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 (test01): Add ifdeffery to
	limit the tested dates.  For simulators, pass start and end dates
	limiting the tested range to 100000 days, centered on days (0).
	* testsuite/std/time/year_month_day/4.cc: Ditto.
This commit is contained in:
Hans-Peter Nilsson 2024-12-29 03:32:04 +01:00
parent c5fd70719a
commit 4da027d87e
2 changed files with 19 additions and 2 deletions

View file

@ -1,4 +1,5 @@
// { dg-do run { target c++20 } }
// { dg-additional-options "-DSTART_DAY=-50000 -DEND_DAY=50000 -DSTART_YMD=1833y/February/8d" { target simulator } }
// Copyright (C) 2021-2024 Free Software Foundation, Inc.
//
@ -50,11 +51,19 @@ void test01()
{
using namespace std::chrono;
#ifdef START_DAY
auto n = days{START_DAY};
auto ymd = START_YMD;
auto end_day = days{END_DAY};
#else
// [-12687428, 11248737] maps to [-32767y/January/1d, 32767y/December/31d]
auto n = days{-12687428};
auto ymd = -32767y/January/1d;
while (n < days{11248737}) {
auto end_day = days{11248737};
#endif
while (n < end_day) {
VERIFY( year_month_day{sys_days{n}} == ymd );
++n;
advance(ymd);

View file

@ -1,4 +1,5 @@
// { dg-do run { target c++20 } }
// { dg-additional-options "-DSTART_DAY=-50000 -DSTART_YMD=1833y/February/8d -DEND_YMD=2106y/November/24d" { target simulator } }
// Copyright (C) 2021-2024 Free Software Foundation, Inc.
//
@ -50,11 +51,18 @@ void test01()
{
using namespace std::chrono;
#ifdef START_DAY
auto n = days{START_DAY};
auto ymd = START_YMD;
#else
// [-32767y/January/1d, 32767y/December/31d] maps to [-12687428, 11248737]
auto n = days{-12687428};
auto ymd = -32767y/January/1d;
while (ymd < 32767y/December/31d) {
#define END_YMD 32767y/December/31d
#endif
while (ymd < END_YMD) {
VERIFY( static_cast<sys_days>(ymd) == sys_days{n} );
++n;
advance(ymd);