Skip to content
Snippets Groups Projects
Commit 4da027d8 authored by Hans-Peter Nilsson's avatar Hans-Peter Nilsson
Browse files

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.
parent c5fd7071
No related branches found
No related tags found
No related merge requests found
// { dg-do run { target c++20 } } // { 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. // Copyright (C) 2021-2024 Free Software Foundation, Inc.
// //
...@@ -50,11 +51,19 @@ void test01() ...@@ -50,11 +51,19 @@ void test01()
{ {
using namespace std::chrono; 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] // [-12687428, 11248737] maps to [-32767y/January/1d, 32767y/December/31d]
auto n = days{-12687428}; auto n = days{-12687428};
auto ymd = -32767y/January/1d; 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 ); VERIFY( year_month_day{sys_days{n}} == ymd );
++n; ++n;
advance(ymd); advance(ymd);
......
// { dg-do run { target c++20 } } // { 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. // Copyright (C) 2021-2024 Free Software Foundation, Inc.
// //
...@@ -50,11 +51,18 @@ void test01() ...@@ -50,11 +51,18 @@ void test01()
{ {
using namespace std::chrono; 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] // [-32767y/January/1d, 32767y/December/31d] maps to [-12687428, 11248737]
auto n = days{-12687428}; auto n = days{-12687428};
auto ymd = -32767y/January/1d; 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} ); VERIFY( static_cast<sys_days>(ymd) == sys_days{n} );
++n; ++n;
advance(ymd); advance(ymd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment