| 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 |
|
| 19 |
#include <inttypes.h> |
| 20 |
#include <unistd.h> |
| 21 |
|
| 22 |
#include <atomic> |
| 23 |
#include <string> |
| 24 |
|
| 25 |
#include "absl/strings/str_format.h" |
| 26 |
|
| 27 |
#include <grpc/grpc.h> |
| 28 |
#include <grpc/grpc_security_constants.h> |
| 29 |
#include <grpc/support/time.h> |
| 30 |
|
| 31 |
#include "test/core/end2end/end2end_tests.h" |
| 32 |
#include "test/core/end2end/fixtures/local_util.h" |
| 33 |
#include "test/core/util/test_config.h" |
| 34 |
|
| 35 |
static std::atomic<int> unique{1}; |
| 36 |
|
| 37 |
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_uds( |
| 38 |
const grpc_channel_args* /*client_args*/, |
| 39 |
const grpc_channel_args* /*server_args*/) { |
| 40 |
grpc_end2end_test_fixture f = |
| 41 |
grpc_end2end_local_chttp2_create_fixture_fullstack(); |
| 42 |
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME); |
| 43 |
static_cast<grpc_end2end_local_fullstack_fixture_data*>(f.fixture_data) |
| 44 |
->localaddr = absl::StrFormat( |
| 45 |
"unix:/tmp/grpc_fullstack_test.%d.%" PRId64 ".%" PRId32 ".%d", getpid(), |
| 46 |
now.tv_sec, now.tv_nsec, unique++); |
| 47 |
return f; |
| 48 |
} |
| 49 |
|
| 50 |
static void chttp2_init_client_fullstack_uds( |
| 51 |
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) { |
| 52 |
grpc_end2end_local_chttp2_init_client_fullstack(f, client_args, UDS); |
| 53 |
} |
| 54 |
|
| 55 |
static void chttp2_init_server_fullstack_uds( |
| 56 |
grpc_end2end_test_fixture* f, const grpc_channel_args* client_args) { |
| 57 |
grpc_end2end_local_chttp2_init_server_fullstack(f, client_args, UDS); |
| 58 |
} |
| 59 |
|
| 60 |
/* All test configurations */ |
| 61 |
static grpc_end2end_test_config configs[] = { |
| 62 |
{"chttp2/fullstack_local_uds", |
| 63 |
FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | |
| 64 |
FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | |
| 65 |
FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER | |
| 66 |
FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS, |
| 67 |
nullptr, chttp2_create_fixture_fullstack_uds, |
| 68 |
chttp2_init_client_fullstack_uds, chttp2_init_server_fullstack_uds, |
| 69 |
grpc_end2end_local_chttp2_tear_down_fullstack}}; |
| 70 |
|
| 71 |
int main(int argc, char** argv) { |
| 72 |
size_t i; |
| 73 |
grpc::testing::TestEnvironment env(&argc, argv); |
| 74 |
grpc_end2end_tests_pre_init(); |
| 75 |
grpc_init(); |
| 76 |
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { |
| 77 |
grpc_end2end_tests(argc, argv, configs[i]); |
| 78 |
} |
| 79 |
grpc_shutdown(); |
| 80 |
return 0; |
| 81 |
} |