]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++-v3/testsuite/.../year_month_day/3.cc, 4.cc: Cut down for simulators
authorHans-Peter Nilsson <hp@bitrange.com>
Sun, 29 Dec 2024 02:32:04 +0000 (03:32 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Sun, 29 Dec 2024 03:19:52 +0000 (04:19 +0100)
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.

libstdc++-v3/testsuite/std/time/year_month_day/3.cc
libstdc++-v3/testsuite/std/time/year_month_day/4.cc

index 05dc750c0a0979c1a5abe1d747518407bf121c9d..f4829a686f79e8e259e63d585e4cbb05ad7b3ded 100644 (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);
index 6b6714e3a85ec6f490d96a06fe582d92a6bf280a..09a7551dcfc0a0c9d7da6da8e07f97a0b60b3780 100644 (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);