diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2017-11-14 09:23:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-14 09:23:10 +0100 |
commit | 4ed062561c3f86aa087865c8ead4c3fe81303bee (patch) | |
tree | 4045f244a7fffaf69745b4aa96189ffba83a3a62 | |
parent | b92229d9c293ab2eb798ab77b17f962564544b5a (diff) | |
parent | 5b2c12e0c202ed2e1fbf3bd19931e84740772d8e (diff) |
Merge pull request #13365 from jtattermusch/stats_test_boundary_skipping
Make stats_test.IncHistogram skip values far from boundaries
-rw-r--r-- | test/core/debug/stats_test.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc index c4b0d502e3..5fae61f8f6 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/debug/stats_test.cc @@ -109,11 +109,12 @@ TEST_P(HistogramTest, IncHistogram) { } }; std::vector<int> test_values; - for (int j = -1000; - j < grpc_stats_histo_bucket_boundaries - [kHistogram][grpc_stats_histo_buckets[kHistogram] - 1] + - 1000; - j++) { + // largest bucket boundary for current histogram type. + int max_bucket_boundary = + grpc_stats_histo_bucket_boundaries[kHistogram] + [grpc_stats_histo_buckets[kHistogram] - + 1]; + for (int j = -1000; j < max_bucket_boundary + 1000;) { int expected_bucket = FindExpectedBucket(kHistogram, j); if (cur_bucket != expected_bucket) { threads.emplace_back( @@ -122,6 +123,14 @@ TEST_P(HistogramTest, IncHistogram) { test_values.clear(); } test_values.push_back(j); + if (j < max_bucket_boundary && + FindExpectedBucket(kHistogram, j + 1000) == expected_bucket && + FindExpectedBucket(kHistogram, j - 1000) == expected_bucket) { + // if we are far from bucket boundary, skip values to speed-up the tests + j += 500; + } else { + j++; + } } run(test_values, cur_bucket); for (auto& t : threads) { |