From b7a8cace34551eef286acd761c9b8e5de1747894 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 5 Oct 2017 09:50:18 -0700 Subject: Add abseil to core, use it for InlinedVector --- tools/run_tests/generated/tests.json | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tools/run_tests/generated/tests.json') diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 1fefb52f07..c3eed8a706 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4102,6 +4102,28 @@ ], "timeout_seconds": 1200 }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "vector_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ -- cgit v1.2.3 From c5fb7e5b73ca587ea59c1657bd221af0743929d5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sun, 8 Oct 2017 03:25:31 +0000 Subject: Use a mutex for an exact test --- build.yaml | 1 + test/core/debug/stats_test.cc | 14 +++++++++----- tools/run_tests/generated/tests.json | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'tools/run_tests/generated/tests.json') diff --git a/build.yaml b/build.yaml index 19ce721be4..211cf6913f 100644 --- a/build.yaml +++ b/build.yaml @@ -4607,6 +4607,7 @@ targets: - grpc - gpr_test_util - gpr + uses_polling: false - name: status_test build: test language: c++ diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc index 35f11eae37..c652e446b8 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/debug/stats_test.cc @@ -20,6 +20,7 @@ extern "C" { #include "src/core/lib/debug/stats.h" } +#include #include #include @@ -86,10 +87,12 @@ class HistogramTest : public ::testing::TestWithParam {}; TEST_P(HistogramTest, IncHistogram) { const int kHistogram = GetParam(); - const int kThreads = std::max(1, (int)gpr_cpu_num_cores()); + const int kBuckets = grpc_stats_histo_buckets[kHistogram]; + const int kThreads = kBuckets; std::vector threads; + std::vector mutexes(kBuckets); for (int thread = 0; thread < kThreads; thread++) { - threads.emplace_back([kHistogram, kThreads, thread]() { + threads.emplace_back([kHistogram, kThreads, thread, &mutexes]() { std::vector test_values; for (int j = -1000 + thread; j < grpc_stats_histo_bucket_boundaries @@ -100,9 +103,10 @@ TEST_P(HistogramTest, IncHistogram) { } std::random_shuffle(test_values.begin(), test_values.end()); for (auto j : test_values) { - Snapshot snapshot; - int expected_bucket = FindExpectedBucket(kHistogram, j); + std::lock_guard lock(mutexes[expected_bucket]); + + Snapshot snapshot; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_stats_inc_histogram[kHistogram](&exec_ctx, j); @@ -110,7 +114,7 @@ TEST_P(HistogramTest, IncHistogram) { auto delta = snapshot.delta(); - EXPECT_GE(delta.histograms[grpc_stats_histo_start[kHistogram] + + EXPECT_EQ(delta.histograms[grpc_stats_histo_start[kHistogram] + expected_bucket], 1) << "\nhistogram:" << kHistogram diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6f9b3cab89..72e840e2f2 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4195,7 +4195,7 @@ "posix", "windows" ], - "uses_polling": true + "uses_polling": false }, { "args": [], -- cgit v1.2.3 From 3cf8d50d1ecc3e9c2dc756cff4d1ff9fcb6c80b9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sun, 8 Oct 2017 05:11:15 +0000 Subject: accurate, exhaustive "fast" version of this test --- build.yaml | 1 + test/core/debug/stats_test.cc | 58 ++++++++++++++++++------------------ tools/run_tests/generated/tests.json | 1 + tools/run_tests/run_tests.py | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-) (limited to 'tools/run_tests/generated/tests.json') diff --git a/build.yaml b/build.yaml index 211cf6913f..1cb00ec146 100644 --- a/build.yaml +++ b/build.yaml @@ -4607,6 +4607,7 @@ targets: - grpc - gpr_test_util - gpr + timeout_seconds: 1200 uses_polling: false - name: status_test build: test diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc index c652e446b8..db9105672e 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/debug/stats_test.cc @@ -87,42 +87,42 @@ class HistogramTest : public ::testing::TestWithParam {}; TEST_P(HistogramTest, IncHistogram) { const int kHistogram = GetParam(); - const int kBuckets = grpc_stats_histo_buckets[kHistogram]; - const int kThreads = kBuckets; std::vector threads; - std::vector mutexes(kBuckets); - for (int thread = 0; thread < kThreads; thread++) { - threads.emplace_back([kHistogram, kThreads, thread, &mutexes]() { + int cur_bucket = 0; + auto run = [kHistogram](const std::vector& test_values, int expected_bucket) { + gpr_log(GPR_DEBUG, "expected_bucket:%d nvalues=%" PRIdPTR, expected_bucket, test_values.size()); + for (auto j : test_values) { + Snapshot snapshot; + + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_stats_inc_histogram[kHistogram](&exec_ctx, j); + grpc_exec_ctx_finish(&exec_ctx); + + auto delta = snapshot.delta(); + + EXPECT_EQ(delta.histograms[grpc_stats_histo_start[kHistogram] + + expected_bucket], + 1) + << "\nhistogram:" << kHistogram + << "\nexpected_bucket:" << expected_bucket + << "\nj:" << j; + } + }; std::vector test_values; - for (int j = -1000 + thread; + for (int j = -1000; j < grpc_stats_histo_bucket_boundaries [kHistogram][grpc_stats_histo_buckets[kHistogram] - 1] + 1000; - j += kThreads) { + j ++) { + int expected_bucket = FindExpectedBucket(kHistogram, j); + if (cur_bucket != expected_bucket) { + threads.emplace_back([test_values, run, cur_bucket]() { run(test_values, cur_bucket); }); + cur_bucket = expected_bucket; + test_values.clear(); + } test_values.push_back(j); } - std::random_shuffle(test_values.begin(), test_values.end()); - for (auto j : test_values) { - int expected_bucket = FindExpectedBucket(kHistogram, j); - std::lock_guard lock(mutexes[expected_bucket]); - - Snapshot snapshot; - - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_stats_inc_histogram[kHistogram](&exec_ctx, j); - grpc_exec_ctx_finish(&exec_ctx); - - auto delta = snapshot.delta(); - - EXPECT_EQ(delta.histograms[grpc_stats_histo_start[kHistogram] + - expected_bucket], - 1) - << "\nhistogram:" << kHistogram - << "\nexpected_bucket:" << expected_bucket << "\nthread:" << thread - << "\nj:" << j; - } - }); - } + run(test_values, cur_bucket); for (auto& t : threads) { t.join(); } diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 72e840e2f2..fa75017781 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4195,6 +4195,7 @@ "posix", "windows" ], + "timeout_seconds": 1200, "uses_polling": false }, { diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 7c65067857..6bdd8be7e9 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -353,7 +353,7 @@ class CLanguage(object): out.append(self.config.job_spec(cmdline, shortname='%s %s' % (' '.join(cmdline), shortname_ext), cpu_cost=cpu_cost, - timeout_seconds=_DEFAULT_TIMEOUT_SECONDS * timeout_scaling, + timeout_seconds=target.get('timeout_seconds', _DEFAULT_TIMEOUT_SECONDS) * timeout_scaling, environ=env)) else: cmdline = [binary] + target['args'] -- cgit v1.2.3 From cec780ed045a79cf27455d2524fc57c6ac18f231 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Oct 2017 08:43:43 -0700 Subject: Fix sanity --- tools/run_tests/generated/tests.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/run_tests/generated/tests.json') diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 07af0c1767..1626a35f31 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4331,7 +4331,8 @@ "mac", "posix", "windows" - ] + ], + "uses_polling": true }, { "args": [], -- cgit v1.2.3 From be6141dc91e02da0391d6b0c280d98714e80a497 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Oct 2017 14:59:16 -0700 Subject: Fix merge --- tools/run_tests/generated/tests.json | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/run_tests/generated/tests.json') diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index b5e05589d4..34412523e9 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4524,6 +4524,7 @@ }, { "args": [], + "benchmark": false, "ci_platforms": [ "linux", "mac", -- cgit v1.2.3 From 5f7ec2b019e22bc3dda119a8e1d12e9630b659ae Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Oct 2017 09:10:45 -0700 Subject: Exclude stats_test from tsan --- build.yaml | 2 ++ tools/run_tests/generated/tests.json | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/run_tests/generated/tests.json') diff --git a/build.yaml b/build.yaml index 117f8c50bb..e3627130c2 100644 --- a/build.yaml +++ b/build.yaml @@ -4719,6 +4719,8 @@ targets: - grpc - gpr_test_util - gpr + exclude_configs: + - tsan timeout_seconds: 1200 uses_polling: false - name: status_test diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 7b1d6fccb3..1ba386b59c 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4206,7 +4206,9 @@ "windows" ], "cpu_cost": 1.0, - "exclude_configs": [], + "exclude_configs": [ + "tsan" + ], "exclude_iomgrs": [], "flaky": false, "gtest": true, -- cgit v1.2.3