summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-05-20 15:44:25 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-05-20 15:47:49 +0100
commite3b8b4f7814c54543d9b7ea3ee8cf2cb9cff351d (patch)
tree9e9aa27947136578384602a3dd338dc7c2b9c59f /libstdc++-v3
parentAArch64: Improve rotate patterns (diff)
downloadgcc-e3b8b4f7814c54543d9b7ea3ee8cf2cb9cff351d.tar.gz
gcc-e3b8b4f7814c54543d9b7ea3ee8cf2cb9cff351d.tar.bz2
gcc-e3b8b4f7814c54543d9b7ea3ee8cf2cb9cff351d.tar.xz
libstdc++: Reduce <random> test iterations for simulators
Some of these tests take several minutes on a simulator like cris-elf, so we can conditionally run fewer iterations. The testDiscreteDist helper already supports custom sizes so we just need to make use of that when { target simulator } matches. The relevant code is sufficiently tested on other targets, so we're not losing anything by only running a small number of iterators for sims. libstdc++-v3/ChangeLog: * testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc: Run fewer iterations for simulator targets. * testsuite/26_numerics/random/binomial_distribution/operators/values.cc: Likewise. * testsuite/26_numerics/random/discrete_distribution/operators/values.cc: Likewise. * testsuite/26_numerics/random/geometric_distribution/operators/values.cc: Likewise. * testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc: Likewise. * testsuite/26_numerics/random/poisson_distribution/operators/values.cc: Likewise. * testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc: Likewise.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc14
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc12
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc8
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc14
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc20
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc15
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc14
7 files changed, 76 insertions, 21 deletions
diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc
index 4100692981c..b2cb86f976b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc
@@ -24,6 +24,14 @@
24#include <functional> 24#include <functional>
25#include <testsuite_random.h> 25#include <testsuite_random.h>
26 26
27// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
28
29#ifdef SIMULATOR_TEST
30# define ARGS 100, 1000
31#else
32# define ARGS
33#endif
34
27void test01() 35void test01()
28{ 36{
29 using namespace __gnu_test; 37 using namespace __gnu_test;
@@ -32,15 +40,15 @@ void test01()
32 40
33 std::bernoulli_distribution bd1(0.25); 41 std::bernoulli_distribution bd1(0.25);
34 auto bbd1 = std::bind(bd1, eng); 42 auto bbd1 = std::bind(bd1, eng);
35 testDiscreteDist(bbd1, [](int n) { return bernoulli_pdf(n, 0.25); } ); 43 testDiscreteDist<ARGS>(bbd1, [](int n) { return bernoulli_pdf(n, 0.25); } );
36 44
37 std::bernoulli_distribution bd2(0.5); 45 std::bernoulli_distribution bd2(0.5);
38 auto bbd2 = std::bind(bd2, eng); 46 auto bbd2 = std::bind(bd2, eng);
39 testDiscreteDist(bbd2, [](int n) { return bernoulli_pdf(n, 0.5); } ); 47 testDiscreteDist<ARGS>(bbd2, [](int n) { return bernoulli_pdf(n, 0.5); } );
40 48
41 std::bernoulli_distribution bd3(0.75); 49 std::bernoulli_distribution bd3(0.75);
42 auto bbd3 = std::bind(bd3, eng); 50 auto bbd3 = std::bind(bd3, eng);
43 testDiscreteDist(bbd3, [](int n) { return bernoulli_pdf(n, 0.75); } ); 51 testDiscreteDist<ARGS>(bbd3, [](int n) { return bernoulli_pdf(n, 0.75); } );
44} 52}
45 53
46int main() 54int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc
index 96570d59fb3..efa259b7e03 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc
@@ -25,6 +25,14 @@
25#include <functional> 25#include <functional>
26#include <testsuite_random.h> 26#include <testsuite_random.h>
27 27
28// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
29
30#ifdef SIMULATOR_TEST
31# define ARGS 100, 1000
32#else
33# define ARGS
34#endif
35
28void test01() 36void test01()
29{ 37{
30 using namespace __gnu_test; 38 using namespace __gnu_test;
@@ -33,9 +41,9 @@ void test01()
33 41
34 std::binomial_distribution<> bd1(5, 0.3); 42 std::binomial_distribution<> bd1(5, 0.3);
35 auto bbd1 = std::bind(bd1, eng); 43 auto bbd1 = std::bind(bd1, eng);
36 testDiscreteDist(bbd1, [](int n) { return binomial_pdf(n, 5, 0.3); } ); 44 testDiscreteDist<ARGS>(bbd1, [](int n) { return binomial_pdf(n, 5, 0.3); } );
37 45
38 // These tests take a relatively long time on soft-float simulated 46 // These tests take a relatively long time on soft-float simulated targets.
39 // targets, so please don't add new tests here, instead add a new file. 47 // targets, so please don't add new tests here, instead add a new file.
40} 48}
41 49
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc
index 1cedd6434ca..8bacb86e173 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc
@@ -24,6 +24,14 @@
24#include <functional> 24#include <functional>
25#include <testsuite_random.h> 25#include <testsuite_random.h>
26 26
27// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
28
29#ifdef SIMULATOR_TEST
30# define ARGS 100, 1000
31#else
32# define ARGS
33#endif
34
27void test01() 35void test01()
28{ 36{
29 using namespace __gnu_test; 37 using namespace __gnu_test;
diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc
index 65e0e79217b..41a83b1377b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc
@@ -24,6 +24,14 @@
24#include <functional> 24#include <functional>
25#include <testsuite_random.h> 25#include <testsuite_random.h>
26 26
27// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
28
29#ifdef SIMULATOR_TEST
30# define ARGS 100, 1000
31#else
32# define ARGS
33#endif
34
27void test01() 35void test01()
28{ 36{
29 using namespace __gnu_test; 37 using namespace __gnu_test;
@@ -32,16 +40,16 @@ void test01()
32 40
33 std::geometric_distribution<> gd1(0.5); 41 std::geometric_distribution<> gd1(0.5);
34 auto bgd1 = std::bind(gd1, eng); 42 auto bgd1 = std::bind(gd1, eng);
35 testDiscreteDist(bgd1, [](int n) { return geometric_pdf(n, 0.5); } ); 43 testDiscreteDist<ARGS>(bgd1, [](int n) { return geometric_pdf(n, 0.5); } );
36 44
37 std::geometric_distribution<> gd2(0.75); 45 std::geometric_distribution<> gd2(0.75);
38 auto bgd2 = std::bind(gd2, eng); 46 auto bgd2 = std::bind(gd2, eng);
39 testDiscreteDist(bgd2, [](int n) { return geometric_pdf(n, 0.75); } ); 47 testDiscreteDist<ARGS>(bgd2, [](int n) { return geometric_pdf(n, 0.75); } );
40 48
41 // libstdc++/48114 49 // libstdc++/48114
42 std::geometric_distribution<> gd3(0.25); 50 std::geometric_distribution<> gd3(0.25);
43 auto bgd3 = std::bind(gd3, eng); 51 auto bgd3 = std::bind(gd3, eng);
44 testDiscreteDist(bgd3, [](int n) { return geometric_pdf(n, 0.25); } ); 52 testDiscreteDist<ARGS>(bgd3, [](int n) { return geometric_pdf(n, 0.25); } );
45} 53}
46 54
47int main() 55int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
index dda6f43b254..9856b888577 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
@@ -26,6 +26,14 @@
26#include <functional> 26#include <functional>
27#include <testsuite_random.h> 27#include <testsuite_random.h>
28 28
29// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
30
31#ifdef SIMULATOR_TEST
32# define ARGS 100, 1000
33#else
34# define ARGS
35#endif
36
29void test01() 37void test01()
30{ 38{
31 using namespace __gnu_test; 39 using namespace __gnu_test;
@@ -34,18 +42,18 @@ void test01()
34 42
35 std::negative_binomial_distribution<> nbd1(5, 0.3); 43 std::negative_binomial_distribution<> nbd1(5, 0.3);
36 auto bnbd1 = std::bind(nbd1, eng); 44 auto bnbd1 = std::bind(nbd1, eng);
37 testDiscreteDist(bnbd1, [](int n) 45 testDiscreteDist<ARGS>(bnbd1, [](int n)
38 { return negative_binomial_pdf(n, 5, 0.3); } ); 46 { return negative_binomial_pdf(n, 5, 0.3); } );
39 47
40 std::negative_binomial_distribution<> nbd2(55, 0.3); 48 std::negative_binomial_distribution<> nbd2(55, 0.3);
41 auto bnbd2 = std::bind(nbd2, eng); 49 auto bnbd2 = std::bind(nbd2, eng);
42 testDiscreteDist(bnbd2, [](int n) 50 testDiscreteDist<ARGS>(bnbd2, [](int n)
43 { return negative_binomial_pdf(n, 55, 0.3); } ); 51 { return negative_binomial_pdf(n, 55, 0.3); } );
44 52
45 std::negative_binomial_distribution<> nbd3(10, 0.75); 53 std::negative_binomial_distribution<> nbd3(10, 0.75);
46 auto bnbd3 = std::bind(nbd3, eng); 54 auto bnbd3 = std::bind(nbd3, eng);
47 testDiscreteDist(bnbd3, [](int n) 55 testDiscreteDist<ARGS>(bnbd3, [](int n)
48 { return negative_binomial_pdf(n, 10, 0.75); } ); 56 { return negative_binomial_pdf(n, 10, 0.75); } );
49} 57}
50 58
51int main() 59int main()
diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc
index 169d720d596..05e8c9f9eb1 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc
@@ -1,4 +1,3 @@
1// { dg-options "-DSIMULATOR_TEST" { target simulator } }
2// { dg-do run { target c++11 } } 1// { dg-do run { target c++11 } }
3// { dg-require-cstdint "" } 2// { dg-require-cstdint "" }
4// { dg-require-cmath "" } 3// { dg-require-cmath "" }
@@ -26,6 +25,14 @@
26#include <functional> 25#include <functional>
27#include <testsuite_random.h> 26#include <testsuite_random.h>
28 27
28// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
29
30#ifdef SIMULATOR_TEST
31# define ARGS 100, 1000
32#else
33# define ARGS
34#endif
35
29void test01() 36void test01()
30{ 37{
31 using namespace __gnu_test; 38 using namespace __gnu_test;
@@ -34,15 +41,15 @@ void test01()
34 41
35 std::poisson_distribution<> pd1(3.0); 42 std::poisson_distribution<> pd1(3.0);
36 auto bpd1 = std::bind(pd1, eng); 43 auto bpd1 = std::bind(pd1, eng);
37 testDiscreteDist(bpd1, [](int n) { return poisson_pdf(n, 3.0); } ); 44 testDiscreteDist<ARGS>(bpd1, [](int n) { return poisson_pdf(n, 3.0); } );
38 45
39 std::poisson_distribution<> pd2(15.0); 46 std::poisson_distribution<> pd2(15.0);
40 auto bpd2 = std::bind(pd2, eng); 47 auto bpd2 = std::bind(pd2, eng);
41 testDiscreteDist(bpd2, [](int n) { return poisson_pdf(n, 15.0); } ); 48 testDiscreteDist<ARGS>(bpd2, [](int n) { return poisson_pdf(n, 15.0); } );
42 49
43 std::poisson_distribution<> pd3(30.0); 50 std::poisson_distribution<> pd3(30.0);
44 auto bpd3 = std::bind(pd3, eng); 51 auto bpd3 = std::bind(pd3, eng);
45 testDiscreteDist(bpd3, [](int n) { return poisson_pdf(n, 30.0); } ); 52 testDiscreteDist<ARGS>(bpd3, [](int n) { return poisson_pdf(n, 30.0); } );
46 53
47 // This can take extremely long on simulators, timing out the test. 54 // This can take extremely long on simulators, timing out the test.
48#ifndef SIMULATOR_TEST 55#ifndef SIMULATOR_TEST
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc
index c1e4b4944cc..ee1ea7ebe5f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc
@@ -24,6 +24,14 @@
24#include <functional> 24#include <functional>
25#include <testsuite_random.h> 25#include <testsuite_random.h>
26 26
27// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } }
28
29#ifdef SIMULATOR_TEST
30# define ARGS 100, 1000
31#else
32# define ARGS
33#endif
34
27void test01() 35void test01()
28{ 36{
29 using namespace __gnu_test; 37 using namespace __gnu_test;
@@ -32,15 +40,15 @@ void test01()
32 40
33 std::uniform_int_distribution<> uid1(0, 2); 41 std::uniform_int_distribution<> uid1(0, 2);
34 auto buid1 = std::bind(uid1, eng); 42 auto buid1 = std::bind(uid1, eng);
35 testDiscreteDist(buid1, [](int n) { return uniform_int_pdf(n, 0, 2); } ); 43 testDiscreteDist<ARGS>(buid1, [](int n) { return uniform_int_pdf(n, 0, 2); } );
36 44
37 std::uniform_int_distribution<> uid2(3, 7); 45 std::uniform_int_distribution<> uid2(3, 7);
38 auto buid2 = std::bind(uid2, eng); 46 auto buid2 = std::bind(uid2, eng);
39 testDiscreteDist(buid2, [](int n) { return uniform_int_pdf(n, 3, 7); } ); 47 testDiscreteDist<ARGS>(buid2, [](int n) { return uniform_int_pdf(n, 3, 7); } );
40 48
41 std::uniform_int_distribution<> uid3(1, 20); 49 std::uniform_int_distribution<> uid3(1, 20);
42 auto buid3 = std::bind(uid3, eng); 50 auto buid3 = std::bind(uid3, eng);
43 testDiscreteDist(buid3, [](int n) { return uniform_int_pdf(n, 1, 20); } ); 51 testDiscreteDist<ARGS>(buid3, [](int n) { return uniform_int_pdf(n, 1, 20); } );
44} 52}
45 53
46int main() 54int main()