diff mbox series

[1/2] libstdc++: Work around some PSTL test failures for debug mode [PR90276]

Message ID 20240620153526.2024602-1-jwakely@redhat.com
State New
Headers show
Series [1/2] libstdc++: Work around some PSTL test failures for debug mode [PR90276] | expand

Commit Message

Jonathan Wakely June 20, 2024, 3:35 p.m. UTC
Tested x86_64-linux.

-- >8 --

This addresses one known failure due to a bug in the upstream tests, and
a number of timeouts due to the algorithms running much more slowly with
debug mode checks enabled.

libstdc++-v3/ChangeLog:

	PR libstdc++/90276
	* testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
	[_GLIBCXX_DEBUG]: Add xfail-run-if for debug mode.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
	[_GLIBCXX_DEBUG]: Reduce size of test data.
	* testsuite/25_algorithms/pstl/alg_sorting/includes.cc:
	Likewise.
	* testsuite/25_algorithms/pstl/alg_sorting/set_util.h:
	Likewise.
---
 .../25_algorithms/pstl/alg_nonmodifying/nth_element.cc        | 4 ++++
 .../testsuite/25_algorithms/pstl/alg_sorting/includes.cc      | 4 ++++
 .../testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc  | 1 +
 .../testsuite/25_algorithms/pstl/alg_sorting/set_util.h       | 4 ++++
 4 files changed, 13 insertions(+)

Comments

Jonathan Wakely June 26, 2024, 8:13 p.m. UTC | #1
Pushed to trunk now.

On Thu, 20 Jun 2024 at 16:36, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> Tested x86_64-linux.
>
> -- >8 --
>
> This addresses one known failure due to a bug in the upstream tests, and
> a number of timeouts due to the algorithms running much more slowly with
> debug mode checks enabled.
>
> libstdc++-v3/ChangeLog:
>
>         PR libstdc++/90276
>         * testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
>         [_GLIBCXX_DEBUG]: Add xfail-run-if for debug mode.
>         * testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
>         [_GLIBCXX_DEBUG]: Reduce size of test data.
>         * testsuite/25_algorithms/pstl/alg_sorting/includes.cc:
>         Likewise.
>         * testsuite/25_algorithms/pstl/alg_sorting/set_util.h:
>         Likewise.
> ---
>  .../25_algorithms/pstl/alg_nonmodifying/nth_element.cc        | 4 ++++
>  .../testsuite/25_algorithms/pstl/alg_sorting/includes.cc      | 4 ++++
>  .../testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc  | 1 +
>  .../testsuite/25_algorithms/pstl/alg_sorting/set_util.h       | 4 ++++
>  4 files changed, 13 insertions(+)
>
> diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
> index 61bbca758b4..63e6abe2ea4 100644
> --- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
> +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
> @@ -133,7 +133,11 @@ void
>  test_by_type(Generator1 generator1, Generator2 generator2, Compare comp)
>  {
>      using namespace std;
> +#ifdef _GLIBCXX_DEBUG
> +    size_t max_size = 1000;
> +#else
>      size_t max_size = 10000;
> +#endif
>      Sequence<T> in1(max_size, [](size_t v) { return T(v); });
>      Sequence<T> exp(max_size, [](size_t v) { return T(v); });
>      size_t m;
> diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
> index ed07810618d..1567c369c4c 100644
> --- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
> +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
> @@ -77,7 +77,11 @@ void
>  test_includes(Compare compare)
>  {
>
> +#ifdef _GLIBCXX_DEBUG
> +    const std::size_t n_max = 10000;
> +#else
>      const std::size_t n_max = 1000000;
> +#endif
>
>      // The rand()%(2*n+1) encourages generation of some duplicates.
>      std::srand(42);
> diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
> index 6d441cc3ae9..797d0ee9340 100644
> --- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
> +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
> @@ -3,6 +3,7 @@
>  // { dg-do run { target c++17 } }
>  // { dg-timeout-factor 3 }
>  // { dg-require-effective-target tbb_backend }
> +// { dg-xfail-run-if "see PR 90276" { debug_mode } }
>
>  //===-- partial_sort.pass.cpp ---------------------------------------------===//
>  //
> diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
> index ecf5cd1c89d..214e3452aa7 100644
> --- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
> +++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
> @@ -51,7 +51,11 @@ namespace TestUtils
>      void
>      test_set_op(Compare compare)
>      {
> +#ifdef _GLIBCXX_DEBUG
> +        const std::size_t n_max = 1000;
> +#else
>          const std::size_t n_max = 100000;
> +#endif
>
>          // The rand()%(2*n+1) encourages generation of some duplicates.
>          std::srand(4200);
> --
> 2.45.2
>
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
index 61bbca758b4..63e6abe2ea4 100644
--- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc
@@ -133,7 +133,11 @@  void
 test_by_type(Generator1 generator1, Generator2 generator2, Compare comp)
 {
     using namespace std;
+#ifdef _GLIBCXX_DEBUG
+    size_t max_size = 1000;
+#else
     size_t max_size = 10000;
+#endif
     Sequence<T> in1(max_size, [](size_t v) { return T(v); });
     Sequence<T> exp(max_size, [](size_t v) { return T(v); });
     size_t m;
diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
index ed07810618d..1567c369c4c 100644
--- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/includes.cc
@@ -77,7 +77,11 @@  void
 test_includes(Compare compare)
 {
 
+#ifdef _GLIBCXX_DEBUG
+    const std::size_t n_max = 10000;
+#else
     const std::size_t n_max = 1000000;
+#endif
 
     // The rand()%(2*n+1) encourages generation of some duplicates.
     std::srand(42);
diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
index 6d441cc3ae9..797d0ee9340 100644
--- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc
@@ -3,6 +3,7 @@ 
 // { dg-do run { target c++17 } }
 // { dg-timeout-factor 3 }
 // { dg-require-effective-target tbb_backend }
+// { dg-xfail-run-if "see PR 90276" { debug_mode } }
 
 //===-- partial_sort.pass.cpp ---------------------------------------------===//
 //
diff --git a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
index ecf5cd1c89d..214e3452aa7 100644
--- a/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
+++ b/libstdc++-v3/testsuite/25_algorithms/pstl/alg_sorting/set_util.h
@@ -51,7 +51,11 @@  namespace TestUtils
     void
     test_set_op(Compare compare)
     {
+#ifdef _GLIBCXX_DEBUG
+        const std::size_t n_max = 1000;
+#else
         const std::size_t n_max = 100000;
+#endif
 
         // The rand()%(2*n+1) encourages generation of some duplicates.
         std::srand(4200);