endpoint_pair_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <grpc/grpc.h>
22 #include <grpc/support/alloc.h>
23 #include <grpc/support/log.h>
24 #include <grpc/support/time.h>
25 
29 
30 static gpr_mu* g_mu;
32 
33 static void clean_up(void) {}
34 
36  size_t slice_size) {
39  grpc_arg a[1];
40  a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
41  a[0].type = GRPC_ARG_INTEGER;
42  a[0].value.integer = static_cast<int>(slice_size);
45  f.client_ep = p.client;
46  f.server_ep = p.server;
49 
50  return f;
51 }
52 
54  {"tcp/tcp_socketpair", create_fixture_endpoint_pair, clean_up},
55 };
56 
57 static void destroy_pollset(void* p, grpc_error_handle /*error*/) {
58  grpc_pollset_destroy(static_cast<grpc_pollset*>(p));
59 }
60 
61 int main(int argc, char** argv) {
62  grpc_closure destroyed;
64  grpc_init();
65  {
71  grpc_schedule_on_exec_ctx);
72  grpc_pollset_shutdown(g_pollset, &destroyed);
73  }
74  grpc_shutdown();
76 
77  return 0;
78 }
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
grpc_arg
Definition: grpc_types.h:103
grpc_pollset_size
size_t grpc_pollset_size(void)
Definition: pollset.cc:56
log.h
grpc_endpoint_test_config
Definition: endpoint_tests.h:34
generate.env
env
Definition: generate.py:37
GRPC_ARG_INTEGER
@ GRPC_ARG_INTEGER
Definition: grpc_types.h:81
grpc_endpoint_tests
void grpc_endpoint_tests(grpc_endpoint_test_config config, grpc_pollset *pollset, gpr_mu *mu)
Definition: endpoint_tests.cc:345
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
useful.h
g_mu
static gpr_mu * g_mu
Definition: endpoint_pair_test.cc:30
time.h
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
xds_manager.p
p
Definition: xds_manager.py:60
g_pollset
static grpc_pollset * g_pollset
Definition: endpoint_pair_test.cc:31
grpc_channel_args
Definition: grpc_types.h:132
create_fixture_endpoint_pair
static grpc_endpoint_test_fixture create_fixture_endpoint_pair(size_t slice_size)
Definition: endpoint_pair_test.cc:35
grpc_pollset_init
void grpc_pollset_init(grpc_pollset *pollset, gpr_mu **mu)
Definition: pollset.cc:33
main
int main(int argc, char **argv)
Definition: endpoint_pair_test.cc:61
gpr_zalloc
GPRAPI void * gpr_zalloc(size_t size)
Definition: alloc.cc:40
endpoint_pair.h
autogen_x86imm.f
f
Definition: autogen_x86imm.py:9
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc.h
configs
static grpc_endpoint_test_config configs[]
Definition: endpoint_pair_test.cc:53
clean_up
static void clean_up(void)
Definition: endpoint_pair_test.cc:33
grpc_core::ExecCtx
Definition: exec_ctx.h:97
test_config.h
GPR_ARRAY_SIZE
#define GPR_ARRAY_SIZE(array)
Definition: useful.h:129
gpr_mu
pthread_mutex_t gpr_mu
Definition: impl/codegen/sync_posix.h:47
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_pollset_shutdown
void grpc_pollset_shutdown(grpc_pollset *pollset, grpc_closure *closure)
Definition: pollset.cc:37
grpc_endpoint_test_fixture
Definition: endpoint_tests.h:29
alloc.h
grpc_iomgr_create_endpoint_pair
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, grpc_channel_args *args)
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
endpoint_tests.h
destroy_pollset
static void destroy_pollset(void *p, grpc_error_handle)
Definition: endpoint_pair_test.cc:57
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_error
Definition: error_internal.h:42
GRPC_ARG_TCP_READ_CHUNK_SIZE
#define GRPC_ARG_TCP_READ_CHUNK_SIZE
Definition: grpc_types.h:330
grpc_endpoint_pair
Definition: endpoint_pair.h:26
grpc_endpoint_add_to_pollset
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset)
Definition: endpoint.cc:35
grpc_pollset
Definition: bm_cq_multiple_threads.cc:37
grpc_pollset_destroy
void grpc_pollset_destroy(grpc_pollset *pollset)
Definition: pollset.cc:41
grpc_closure
Definition: closure.h:56
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:19