Debian Codegraph @

test/core/end2end/fixtures/h2_local_ipv4.cc

raw
1 /*
2 *
3 * Copyright 2018 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
19 #include <unistd.h>
20
21 #include <string>
22
23 #include <grpc/grpc.h>
24 #include <grpc/grpc_security_constants.h>
25
26 #include "src/core/lib/gprpp/host_port.h"
27 #include "test/core/end2end/end2end_tests.h"
28 #include "test/core/end2end/fixtures/local_util.h"
29 #include "test/core/util/port.h"
30 #include "test/core/util/test_config.h"
31
32 static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_ipv4(
33 const grpc_channel_args* /*client_args*/,
34 const grpc_channel_args* /*server_args*/) {
35 grpc_end2end_test_fixture f =
36 grpc_end2end_local_chttp2_create_fixture_fullstack();
37 int port = grpc_pick_unused_port_or_die();
38 static_cast<grpc_end2end_local_fullstack_fixture_data*>(f.fixture_data)
39 ->localaddr = grpc_core::JoinHostPort("127.0.0.1", port);
40 return f;
41 }
42
43 static void chttp2_init_client_fullstack_ipv4(
44 grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
45 grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, LOCAL_TCP);
46 }
47
48 static void chttp2_init_server_fullstack_ipv4(
49 grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) {
50 grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, LOCAL_TCP);
51 }
52
53 /* All test configurations */
54 static grpc_end2end_test_config configs[] = {
55 {"chttp2/fullstack_local_ipv4",
56 FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION |
57 FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL |
58 FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER |
59 FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS,
60 nullptr, chttp2_create_fixture_fullstack_ipv4,
61 chttp2_init_client_fullstack_ipv4, chttp2_init_server_fullstack_ipv4,
62 grpc_end2end_local_chttp2_tear_down_fullstack}};
63
64 int main(int argc, char** argv) {
65 size_t i;
66 grpc::testing::TestEnvironment env(&argc, argv);
67 grpc_end2end_tests_pre_init();
68 grpc_init();
69 for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) {
70 grpc_end2end_tests(argc, argv, configs[i]);
71 }
72 grpc_shutdown();
73 return 0;
74 }