The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.5 KiB

//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include "src/core/lib/iomgr/combiner.h"
#include <gtest/gtest.h>
#include <grpc/grpc.h>
9 years ago
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/crash.h"
7 years ago
#include "src/core/lib/gprpp/thd.h"
#include "test/core/util/test_config.h"
TEST(CombinerTest, TestNoOp) {
gpr_log(GPR_DEBUG, "test_no_op");
grpc_core::ExecCtx exec_ctx;
GRPC_COMBINER_UNREF(grpc_combiner_create(), "test_no_op");
}
static void set_event_to_true(void* value, grpc_error_handle /*error*/) {
gpr_event_set(static_cast<gpr_event*>(value), reinterpret_cast<void*>(1));
}
TEST(CombinerTest, TestExecuteOne) {
gpr_log(GPR_DEBUG, "test_execute_one");
grpc_core::Combiner* lock = grpc_combiner_create();
gpr_event done;
gpr_event_init(&done);
grpc_core::ExecCtx exec_ctx;
Squashed commit of the following: commit 1547cb209ad4f6899bf10c06c34b814783fd3924 Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 13:12:55 2019 -0700 Revert some other GRPC_CLOSURE_RUN till other issues are fixed commit 3edeee7ce9a06eec8901dfe01ea45fb6f5505dbc Merge: 22b343e4fb e8f78e7a5d Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:26:26 2019 -0700 Merge branch 'master' into combinernew commit 22b343e4fb823e625646864454fe6ea3f9f371de Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:22:34 2019 -0700 Change some TCP posix closures to GRPC_CLOSURE_RUN commit 19e60dfe8f6426236c618779f569df7dfed51597 Merge: 153bdcbc97 feae38d3ab Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:56:46 2019 -0700 Merge branch 'master' into combinernew commit 153bdcbc974126dfd123b48e9bfb60e89dc3890e Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:41:14 2019 -0700 Proxy fixture fix commit c6da80bcce6fdc9bec62a6144d775382f165ba93 Merge: 6a32264cdf 98abc22f4c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:05:18 2019 -0700 Merge branch 'master' into combinernew commit 6a32264cdf35c4b833748bdc64efd553435ce87c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:01:55 2019 -0700 Reviewer comments commit 6bbd3a1c3c6c23ae4401020f1981ac003524aa7d Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:55:43 2019 -0700 Fallback cleanup commit aaa04526a2acf225825e218174f07a845af34546 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:24:18 2019 -0700 Clean up commit 4266be13d554136af02d50e5f92dd95a914f9839 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:20:05 2019 -0700 Make sure start_ping is called before finish_ping for bdp and keepalive commit 14107957aa5a17bd0a46b019cffdab41ff60b0f2 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:56:07 2019 -0700 chttp2 fixes commit 5643aa6cb388a508d45cd9aa6a9b65d06a009c7e Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:25:19 2019 -0700 Remove closure list scheduling from combiners commit c59644943084ca7c2f0b67cc4a4679901454f207 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:35:54 2019 -0700 ares windows fix commit 9f933903b969d290acd8fb52e57c37d820f16f34 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:23:11 2019 -0700 More fixes commit 3c3a7d0e9b365b086c2bec9b87c600dae05c4689 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 16:08:07 2019 -0700 Fix errors commit 56539cc448a225c4936e712d29cd9a1022320aae Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 15:22:28 2019 -0700 Everything compiles commit 714ec01e4b61972c32fd1102d9e46da9e91d70fb Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:44:18 2019 -0700 src compiles commit 54dcbd170d08e91b20a83cc0c9e23d01bc1e05a7 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:16:08 2019 -0700 chttp2_transport changes commit 7a3388b077d92b741679e834f22f4f4731394c66 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 18:33:55 2019 -0700 resource quota and lb policy commit 714e4c849fea25b2650b04c05fc9f9116c9659ca Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 17:23:04 2019 -0700 Further commit 1d17ad7d444a018dd7a0bab3c2351d25502d8a16 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 13:34:52 2019 -0700 ares ev driver windows changes commit 3110c062c5e57eb8241db7699c6638cdb68a5a88 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:47:37 2019 -0700 ares dns changes commit 0e10bc17eac160189c390e54f9c91bbc666ff697 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:24:45 2019 -0700 Add dns_resolver changes commit 4a71a911e8249dfbcf4a2c1397e3b0691265fe0b Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:08:10 2019 -0700 Add fake_resolver changes commit 8610a64ec9cc3bae10a5816e2a4800e0755bbb71 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 19:31:13 2019 -0700 Remaning one from xds_client commit 5f22055d0d3d177b8e3256e371b828abd3b88641 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 18:47:28 2019 -0700 One left from xds_client.cc commit 4b1223f8753c103760cf9a15660a6786859a607f Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 17:17:12 2019 -0700 modifications for xds.cc commit a17bbbd840f56cbc608b463fb04ebabcc8152c01 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 13:06:25 2019 -0700 grpclb.cc changes commit 3a33ed4762616397281a7d0e60e07d92439438f3 Merge: 11058748fd 3d363368ca Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:24:11 2019 -0700 Merge branch 'combinernew' of github.com:yashykt/grpc into combinernew commit 3d363368ca0a0779182afeda0eb3279dc951d757 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:18:00 2019 -0700 New combiner
5 years ago
lock->Run(GRPC_CLOSURE_CREATE(set_event_to_true, &done, nullptr),
absl::OkStatus());
grpc_core::ExecCtx::Get()->Flush();
ASSERT_NE(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)),
nullptr);
GRPC_COMBINER_UNREF(lock, "test_execute_one");
}
typedef struct {
size_t ctr;
Squashed commit of the following: commit 1547cb209ad4f6899bf10c06c34b814783fd3924 Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 13:12:55 2019 -0700 Revert some other GRPC_CLOSURE_RUN till other issues are fixed commit 3edeee7ce9a06eec8901dfe01ea45fb6f5505dbc Merge: 22b343e4fb e8f78e7a5d Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:26:26 2019 -0700 Merge branch 'master' into combinernew commit 22b343e4fb823e625646864454fe6ea3f9f371de Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:22:34 2019 -0700 Change some TCP posix closures to GRPC_CLOSURE_RUN commit 19e60dfe8f6426236c618779f569df7dfed51597 Merge: 153bdcbc97 feae38d3ab Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:56:46 2019 -0700 Merge branch 'master' into combinernew commit 153bdcbc974126dfd123b48e9bfb60e89dc3890e Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:41:14 2019 -0700 Proxy fixture fix commit c6da80bcce6fdc9bec62a6144d775382f165ba93 Merge: 6a32264cdf 98abc22f4c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:05:18 2019 -0700 Merge branch 'master' into combinernew commit 6a32264cdf35c4b833748bdc64efd553435ce87c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:01:55 2019 -0700 Reviewer comments commit 6bbd3a1c3c6c23ae4401020f1981ac003524aa7d Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:55:43 2019 -0700 Fallback cleanup commit aaa04526a2acf225825e218174f07a845af34546 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:24:18 2019 -0700 Clean up commit 4266be13d554136af02d50e5f92dd95a914f9839 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:20:05 2019 -0700 Make sure start_ping is called before finish_ping for bdp and keepalive commit 14107957aa5a17bd0a46b019cffdab41ff60b0f2 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:56:07 2019 -0700 chttp2 fixes commit 5643aa6cb388a508d45cd9aa6a9b65d06a009c7e Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:25:19 2019 -0700 Remove closure list scheduling from combiners commit c59644943084ca7c2f0b67cc4a4679901454f207 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:35:54 2019 -0700 ares windows fix commit 9f933903b969d290acd8fb52e57c37d820f16f34 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:23:11 2019 -0700 More fixes commit 3c3a7d0e9b365b086c2bec9b87c600dae05c4689 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 16:08:07 2019 -0700 Fix errors commit 56539cc448a225c4936e712d29cd9a1022320aae Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 15:22:28 2019 -0700 Everything compiles commit 714ec01e4b61972c32fd1102d9e46da9e91d70fb Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:44:18 2019 -0700 src compiles commit 54dcbd170d08e91b20a83cc0c9e23d01bc1e05a7 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:16:08 2019 -0700 chttp2_transport changes commit 7a3388b077d92b741679e834f22f4f4731394c66 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 18:33:55 2019 -0700 resource quota and lb policy commit 714e4c849fea25b2650b04c05fc9f9116c9659ca Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 17:23:04 2019 -0700 Further commit 1d17ad7d444a018dd7a0bab3c2351d25502d8a16 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 13:34:52 2019 -0700 ares ev driver windows changes commit 3110c062c5e57eb8241db7699c6638cdb68a5a88 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:47:37 2019 -0700 ares dns changes commit 0e10bc17eac160189c390e54f9c91bbc666ff697 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:24:45 2019 -0700 Add dns_resolver changes commit 4a71a911e8249dfbcf4a2c1397e3b0691265fe0b Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:08:10 2019 -0700 Add fake_resolver changes commit 8610a64ec9cc3bae10a5816e2a4800e0755bbb71 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 19:31:13 2019 -0700 Remaning one from xds_client commit 5f22055d0d3d177b8e3256e371b828abd3b88641 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 18:47:28 2019 -0700 One left from xds_client.cc commit 4b1223f8753c103760cf9a15660a6786859a607f Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 17:17:12 2019 -0700 modifications for xds.cc commit a17bbbd840f56cbc608b463fb04ebabcc8152c01 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 13:06:25 2019 -0700 grpclb.cc changes commit 3a33ed4762616397281a7d0e60e07d92439438f3 Merge: 11058748fd 3d363368ca Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:24:11 2019 -0700 Merge branch 'combinernew' of github.com:yashykt/grpc into combinernew commit 3d363368ca0a0779182afeda0eb3279dc951d757 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:18:00 2019 -0700 New combiner
5 years ago
grpc_core::Combiner* lock;
gpr_event done;
} thd_args;
typedef struct {
size_t* ctr;
size_t value;
} ex_args;
static void check_one(void* a, grpc_error_handle /*error*/) {
7 years ago
ex_args* args = static_cast<ex_args*>(a);
ASSERT_EQ(*args->ctr, args->value - 1);
*args->ctr = args->value;
9 years ago
gpr_free(a);
}
static void execute_many_loop(void* a) {
7 years ago
thd_args* args = static_cast<thd_args*>(a);
grpc_core::ExecCtx exec_ctx;
size_t n = 1;
for (size_t i = 0; i < 10; i++) {
for (size_t j = 0; j < 10000; j++) {
7 years ago
ex_args* c = static_cast<ex_args*>(gpr_malloc(sizeof(*c)));
9 years ago
c->ctr = &args->ctr;
c->value = n++;
Squashed commit of the following: commit 1547cb209ad4f6899bf10c06c34b814783fd3924 Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 13:12:55 2019 -0700 Revert some other GRPC_CLOSURE_RUN till other issues are fixed commit 3edeee7ce9a06eec8901dfe01ea45fb6f5505dbc Merge: 22b343e4fb e8f78e7a5d Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:26:26 2019 -0700 Merge branch 'master' into combinernew commit 22b343e4fb823e625646864454fe6ea3f9f371de Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:22:34 2019 -0700 Change some TCP posix closures to GRPC_CLOSURE_RUN commit 19e60dfe8f6426236c618779f569df7dfed51597 Merge: 153bdcbc97 feae38d3ab Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:56:46 2019 -0700 Merge branch 'master' into combinernew commit 153bdcbc974126dfd123b48e9bfb60e89dc3890e Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:41:14 2019 -0700 Proxy fixture fix commit c6da80bcce6fdc9bec62a6144d775382f165ba93 Merge: 6a32264cdf 98abc22f4c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:05:18 2019 -0700 Merge branch 'master' into combinernew commit 6a32264cdf35c4b833748bdc64efd553435ce87c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:01:55 2019 -0700 Reviewer comments commit 6bbd3a1c3c6c23ae4401020f1981ac003524aa7d Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:55:43 2019 -0700 Fallback cleanup commit aaa04526a2acf225825e218174f07a845af34546 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:24:18 2019 -0700 Clean up commit 4266be13d554136af02d50e5f92dd95a914f9839 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:20:05 2019 -0700 Make sure start_ping is called before finish_ping for bdp and keepalive commit 14107957aa5a17bd0a46b019cffdab41ff60b0f2 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:56:07 2019 -0700 chttp2 fixes commit 5643aa6cb388a508d45cd9aa6a9b65d06a009c7e Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:25:19 2019 -0700 Remove closure list scheduling from combiners commit c59644943084ca7c2f0b67cc4a4679901454f207 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:35:54 2019 -0700 ares windows fix commit 9f933903b969d290acd8fb52e57c37d820f16f34 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:23:11 2019 -0700 More fixes commit 3c3a7d0e9b365b086c2bec9b87c600dae05c4689 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 16:08:07 2019 -0700 Fix errors commit 56539cc448a225c4936e712d29cd9a1022320aae Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 15:22:28 2019 -0700 Everything compiles commit 714ec01e4b61972c32fd1102d9e46da9e91d70fb Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:44:18 2019 -0700 src compiles commit 54dcbd170d08e91b20a83cc0c9e23d01bc1e05a7 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:16:08 2019 -0700 chttp2_transport changes commit 7a3388b077d92b741679e834f22f4f4731394c66 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 18:33:55 2019 -0700 resource quota and lb policy commit 714e4c849fea25b2650b04c05fc9f9116c9659ca Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 17:23:04 2019 -0700 Further commit 1d17ad7d444a018dd7a0bab3c2351d25502d8a16 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 13:34:52 2019 -0700 ares ev driver windows changes commit 3110c062c5e57eb8241db7699c6638cdb68a5a88 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:47:37 2019 -0700 ares dns changes commit 0e10bc17eac160189c390e54f9c91bbc666ff697 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:24:45 2019 -0700 Add dns_resolver changes commit 4a71a911e8249dfbcf4a2c1397e3b0691265fe0b Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:08:10 2019 -0700 Add fake_resolver changes commit 8610a64ec9cc3bae10a5816e2a4800e0755bbb71 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 19:31:13 2019 -0700 Remaning one from xds_client commit 5f22055d0d3d177b8e3256e371b828abd3b88641 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 18:47:28 2019 -0700 One left from xds_client.cc commit 4b1223f8753c103760cf9a15660a6786859a607f Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 17:17:12 2019 -0700 modifications for xds.cc commit a17bbbd840f56cbc608b463fb04ebabcc8152c01 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 13:06:25 2019 -0700 grpclb.cc changes commit 3a33ed4762616397281a7d0e60e07d92439438f3 Merge: 11058748fd 3d363368ca Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:24:11 2019 -0700 Merge branch 'combinernew' of github.com:yashykt/grpc into combinernew commit 3d363368ca0a0779182afeda0eb3279dc951d757 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:18:00 2019 -0700 New combiner
5 years ago
args->lock->Run(GRPC_CLOSURE_CREATE(check_one, c, nullptr),
absl::OkStatus());
grpc_core::ExecCtx::Get()->Flush();
}
// sleep for a little bit, to test a combiner draining and another thread
// picking it up
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100));
}
Squashed commit of the following: commit 1547cb209ad4f6899bf10c06c34b814783fd3924 Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 13:12:55 2019 -0700 Revert some other GRPC_CLOSURE_RUN till other issues are fixed commit 3edeee7ce9a06eec8901dfe01ea45fb6f5505dbc Merge: 22b343e4fb e8f78e7a5d Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:26:26 2019 -0700 Merge branch 'master' into combinernew commit 22b343e4fb823e625646864454fe6ea3f9f371de Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:22:34 2019 -0700 Change some TCP posix closures to GRPC_CLOSURE_RUN commit 19e60dfe8f6426236c618779f569df7dfed51597 Merge: 153bdcbc97 feae38d3ab Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:56:46 2019 -0700 Merge branch 'master' into combinernew commit 153bdcbc974126dfd123b48e9bfb60e89dc3890e Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:41:14 2019 -0700 Proxy fixture fix commit c6da80bcce6fdc9bec62a6144d775382f165ba93 Merge: 6a32264cdf 98abc22f4c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:05:18 2019 -0700 Merge branch 'master' into combinernew commit 6a32264cdf35c4b833748bdc64efd553435ce87c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:01:55 2019 -0700 Reviewer comments commit 6bbd3a1c3c6c23ae4401020f1981ac003524aa7d Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:55:43 2019 -0700 Fallback cleanup commit aaa04526a2acf225825e218174f07a845af34546 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:24:18 2019 -0700 Clean up commit 4266be13d554136af02d50e5f92dd95a914f9839 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:20:05 2019 -0700 Make sure start_ping is called before finish_ping for bdp and keepalive commit 14107957aa5a17bd0a46b019cffdab41ff60b0f2 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:56:07 2019 -0700 chttp2 fixes commit 5643aa6cb388a508d45cd9aa6a9b65d06a009c7e Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:25:19 2019 -0700 Remove closure list scheduling from combiners commit c59644943084ca7c2f0b67cc4a4679901454f207 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:35:54 2019 -0700 ares windows fix commit 9f933903b969d290acd8fb52e57c37d820f16f34 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:23:11 2019 -0700 More fixes commit 3c3a7d0e9b365b086c2bec9b87c600dae05c4689 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 16:08:07 2019 -0700 Fix errors commit 56539cc448a225c4936e712d29cd9a1022320aae Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 15:22:28 2019 -0700 Everything compiles commit 714ec01e4b61972c32fd1102d9e46da9e91d70fb Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:44:18 2019 -0700 src compiles commit 54dcbd170d08e91b20a83cc0c9e23d01bc1e05a7 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:16:08 2019 -0700 chttp2_transport changes commit 7a3388b077d92b741679e834f22f4f4731394c66 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 18:33:55 2019 -0700 resource quota and lb policy commit 714e4c849fea25b2650b04c05fc9f9116c9659ca Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 17:23:04 2019 -0700 Further commit 1d17ad7d444a018dd7a0bab3c2351d25502d8a16 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 13:34:52 2019 -0700 ares ev driver windows changes commit 3110c062c5e57eb8241db7699c6638cdb68a5a88 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:47:37 2019 -0700 ares dns changes commit 0e10bc17eac160189c390e54f9c91bbc666ff697 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:24:45 2019 -0700 Add dns_resolver changes commit 4a71a911e8249dfbcf4a2c1397e3b0691265fe0b Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:08:10 2019 -0700 Add fake_resolver changes commit 8610a64ec9cc3bae10a5816e2a4800e0755bbb71 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 19:31:13 2019 -0700 Remaning one from xds_client commit 5f22055d0d3d177b8e3256e371b828abd3b88641 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 18:47:28 2019 -0700 One left from xds_client.cc commit 4b1223f8753c103760cf9a15660a6786859a607f Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 17:17:12 2019 -0700 modifications for xds.cc commit a17bbbd840f56cbc608b463fb04ebabcc8152c01 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 13:06:25 2019 -0700 grpclb.cc changes commit 3a33ed4762616397281a7d0e60e07d92439438f3 Merge: 11058748fd 3d363368ca Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:24:11 2019 -0700 Merge branch 'combinernew' of github.com:yashykt/grpc into combinernew commit 3d363368ca0a0779182afeda0eb3279dc951d757 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:18:00 2019 -0700 New combiner
5 years ago
args->lock->Run(GRPC_CLOSURE_CREATE(set_event_to_true, &args->done, nullptr),
absl::OkStatus());
}
TEST(CombinerTest, TestExecuteMany) {
gpr_log(GPR_DEBUG, "test_execute_many");
grpc_core::Combiner* lock = grpc_combiner_create();
grpc_core::Thread thds[10];
thd_args ta[GPR_ARRAY_SIZE(thds)];
for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) {
ta[i].ctr = 0;
ta[i].lock = lock;
gpr_event_init(&ta[i].done);
thds[i] = grpc_core::Thread("grpc_execute_many", execute_many_loop, &ta[i]);
thds[i].Start();
}
for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) {
ASSERT_NE(gpr_event_wait(&ta[i].done, gpr_inf_future(GPR_CLOCK_REALTIME)),
nullptr);
thds[i].Join();
}
grpc_core::ExecCtx exec_ctx;
GRPC_COMBINER_UNREF(lock, "test_execute_many");
}
static gpr_event got_in_finally;
static void in_finally(void* /*arg*/, grpc_error_handle /*error*/) {
gpr_event_set(&got_in_finally, reinterpret_cast<void*>(1));
}
static void add_finally(void* arg, grpc_error_handle /*error*/) {
Squashed commit of the following: commit 1547cb209ad4f6899bf10c06c34b814783fd3924 Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 13:12:55 2019 -0700 Revert some other GRPC_CLOSURE_RUN till other issues are fixed commit 3edeee7ce9a06eec8901dfe01ea45fb6f5505dbc Merge: 22b343e4fb e8f78e7a5d Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:26:26 2019 -0700 Merge branch 'master' into combinernew commit 22b343e4fb823e625646864454fe6ea3f9f371de Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 18 12:22:34 2019 -0700 Change some TCP posix closures to GRPC_CLOSURE_RUN commit 19e60dfe8f6426236c618779f569df7dfed51597 Merge: 153bdcbc97 feae38d3ab Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:56:46 2019 -0700 Merge branch 'master' into combinernew commit 153bdcbc974126dfd123b48e9bfb60e89dc3890e Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 17 11:41:14 2019 -0700 Proxy fixture fix commit c6da80bcce6fdc9bec62a6144d775382f165ba93 Merge: 6a32264cdf 98abc22f4c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:05:18 2019 -0700 Merge branch 'master' into combinernew commit 6a32264cdf35c4b833748bdc64efd553435ce87c Author: Yash Tibrewal <yashkt@google.com> Date: Fri Oct 11 17:01:55 2019 -0700 Reviewer comments commit 6bbd3a1c3c6c23ae4401020f1981ac003524aa7d Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:55:43 2019 -0700 Fallback cleanup commit aaa04526a2acf225825e218174f07a845af34546 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:24:18 2019 -0700 Clean up commit 4266be13d554136af02d50e5f92dd95a914f9839 Author: Yash Tibrewal <yashkt@google.com> Date: Thu Oct 10 11:20:05 2019 -0700 Make sure start_ping is called before finish_ping for bdp and keepalive commit 14107957aa5a17bd0a46b019cffdab41ff60b0f2 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:56:07 2019 -0700 chttp2 fixes commit 5643aa6cb388a508d45cd9aa6a9b65d06a009c7e Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 18:25:19 2019 -0700 Remove closure list scheduling from combiners commit c59644943084ca7c2f0b67cc4a4679901454f207 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:35:54 2019 -0700 ares windows fix commit 9f933903b969d290acd8fb52e57c37d820f16f34 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 17:23:11 2019 -0700 More fixes commit 3c3a7d0e9b365b086c2bec9b87c600dae05c4689 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 16:08:07 2019 -0700 Fix errors commit 56539cc448a225c4936e712d29cd9a1022320aae Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 15:22:28 2019 -0700 Everything compiles commit 714ec01e4b61972c32fd1102d9e46da9e91d70fb Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:44:18 2019 -0700 src compiles commit 54dcbd170d08e91b20a83cc0c9e23d01bc1e05a7 Author: Yash Tibrewal <yashkt@google.com> Date: Wed Oct 9 13:16:08 2019 -0700 chttp2_transport changes commit 7a3388b077d92b741679e834f22f4f4731394c66 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 18:33:55 2019 -0700 resource quota and lb policy commit 714e4c849fea25b2650b04c05fc9f9116c9659ca Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 17:23:04 2019 -0700 Further commit 1d17ad7d444a018dd7a0bab3c2351d25502d8a16 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 13:34:52 2019 -0700 ares ev driver windows changes commit 3110c062c5e57eb8241db7699c6638cdb68a5a88 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:47:37 2019 -0700 ares dns changes commit 0e10bc17eac160189c390e54f9c91bbc666ff697 Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:24:45 2019 -0700 Add dns_resolver changes commit 4a71a911e8249dfbcf4a2c1397e3b0691265fe0b Author: Yash Tibrewal <yashkt@google.com> Date: Tue Oct 8 12:08:10 2019 -0700 Add fake_resolver changes commit 8610a64ec9cc3bae10a5816e2a4800e0755bbb71 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 19:31:13 2019 -0700 Remaning one from xds_client commit 5f22055d0d3d177b8e3256e371b828abd3b88641 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 18:47:28 2019 -0700 One left from xds_client.cc commit 4b1223f8753c103760cf9a15660a6786859a607f Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 17:17:12 2019 -0700 modifications for xds.cc commit a17bbbd840f56cbc608b463fb04ebabcc8152c01 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 13:06:25 2019 -0700 grpclb.cc changes commit 3a33ed4762616397281a7d0e60e07d92439438f3 Merge: 11058748fd 3d363368ca Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:24:11 2019 -0700 Merge branch 'combinernew' of github.com:yashykt/grpc into combinernew commit 3d363368ca0a0779182afeda0eb3279dc951d757 Author: Yash Tibrewal <yashkt@google.com> Date: Mon Oct 7 11:18:00 2019 -0700 New combiner
5 years ago
static_cast<grpc_core::Combiner*>(arg)->Run(
GRPC_CLOSURE_CREATE(in_finally, arg, nullptr), absl::OkStatus());
}
TEST(CombinerTest, TestExecuteFinally) {
gpr_log(GPR_DEBUG, "test_execute_finally");
grpc_core::Combiner* lock = grpc_combiner_create();
grpc_core::ExecCtx exec_ctx;
gpr_event_init(&got_in_finally);
lock->Run(GRPC_CLOSURE_CREATE(add_finally, lock, nullptr), absl::OkStatus());
grpc_core::ExecCtx::Get()->Flush();
ASSERT_NE(
gpr_event_wait(&got_in_finally, grpc_timeout_seconds_to_deadline(5)),
nullptr);
GRPC_COMBINER_UNREF(lock, "test_execute_finally");
}
int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(&argc, argv);
::testing::InitGoogleTest(&argc, argv);
grpc::testing::TestGrpcScope grpc_scope;
return RUN_ALL_TESTS();
}