From c2d749dea09625718ddf89b65ebdcbb64abc7893 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 15 Oct 2019 17:03:23 -0700 Subject: [PATCH] Fix portability issues and make more readable --- .../cpp/thread_manager/thread_manager_test.cc | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index f3c26891ed2..9f46f8b668f 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -69,7 +69,7 @@ class TestThreadManager final : public grpc::ThreadManager { num_work_found_(0) {} grpc::ThreadManager::WorkStatus PollForWork(void** tag, bool* ok) override; - void DoWork(void* tag, bool ok, bool resources) override { + void DoWork(void* /* tag */, bool /*ok*/, bool /*resources*/) override { num_do_work_.fetch_add(1, std::memory_order_relaxed); // Simulate work by sleeping @@ -143,18 +143,16 @@ class ThreadManagerTest std::vector> thread_manager_; }; -INSTANTIATE_TEST_SUITE_P( - ThreadManagerTest, ThreadManagerTest, - ::testing::ValuesIn( - {TestThreadManagerSettings{ - 2 /* min_pollers */, 10 /* max_pollers */, - 10 /* poll_duration_ms */, 1 /* work_duration_ms */, - 50 /* max_poll_calls */, INT_MAX /* thread_limit */, - 1 /* thread_manager_count */}, - TestThreadManagerSettings{ - 1 /* min_pollers */, 1 /* max_pollers */, 1 /* poll_duration_ms */, - 10 /* work_duration_ms */, 50 /* max_poll_calls */, - 3 /* thread_limit */, 2 /* thread_manager_count */}})); +TestThreadManagerSettings scenarios[] = { + {2 /* min_pollers */, 10 /* max_pollers */, 10 /* poll_duration_ms */, + 1 /* work_duration_ms */, 50 /* max_poll_calls */, + INT_MAX /* thread_limit */, 1 /* thread_manager_count */}, + {1 /* min_pollers */, 1 /* max_pollers */, 1 /* poll_duration_ms */, + 10 /* work_duration_ms */, 50 /* max_poll_calls */, 3 /* thread_limit */, + 2 /* thread_manager_count */}}; + +INSTANTIATE_TEST_SUITE_P(ThreadManagerTest, ThreadManagerTest, + ::testing::ValuesIn(scenarios)); TEST_P(ThreadManagerTest, TestPollAndWork) { for (auto& tm : thread_manager_) {