| 1 |
<%def name="end2end_selector(tests)"> |
| 2 |
/* |
| 3 |
* |
| 4 |
* Copyright 2015 gRPC authors. |
| 5 |
* |
| 6 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 |
* you may not use this file except in compliance with the License. |
| 8 |
* You may obtain a copy of the License at |
| 9 |
* |
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 |
* |
| 12 |
* Unless required by applicable law or agreed to in writing, software |
| 13 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 |
* See the License for the specific language governing permissions and |
| 16 |
* limitations under the License. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
<% tests = sorted(tests) %>\ |
| 21 |
/* This file is auto-generated */ |
| 22 |
|
| 23 |
#include "test/core/end2end/end2end_tests.h" |
| 24 |
|
| 25 |
#include <stdbool.h> |
| 26 |
#include <string.h> |
| 27 |
|
| 28 |
#include <grpc/support/log.h> |
| 29 |
|
| 30 |
|
| 31 |
static bool g_pre_init_called = false; |
| 32 |
|
| 33 |
% for test in tests: |
| 34 |
extern void ${test}(grpc_end2end_test_config config); |
| 35 |
extern void ${test}_pre_init(void); |
| 36 |
% endfor |
| 37 |
|
| 38 |
void grpc_end2end_tests_pre_init(void) { |
| 39 |
GPR_ASSERT(!g_pre_init_called); |
| 40 |
g_pre_init_called = true; |
| 41 |
% for test in tests: |
| 42 |
${test}_pre_init(); |
| 43 |
% endfor |
| 44 |
} |
| 45 |
|
| 46 |
// NOLINTNEXTLINE(readability-function-size) |
| 47 |
void grpc_end2end_tests(int argc, char **argv, |
| 48 |
grpc_end2end_test_config config) { |
| 49 |
int i; |
| 50 |
|
| 51 |
GPR_ASSERT(g_pre_init_called); |
| 52 |
|
| 53 |
if (argc <= 1) { |
| 54 |
% for test in tests: |
| 55 |
${test}(config); |
| 56 |
% endfor |
| 57 |
return; |
| 58 |
} |
| 59 |
|
| 60 |
for (i = 1; i < argc; i++) { |
| 61 |
% for test in tests: |
| 62 |
if (0 == strcmp("${test}", argv[i])) { |
| 63 |
${test}(config); |
| 64 |
continue; |
| 65 |
} |
| 66 |
% endfor |
| 67 |
gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); |
| 68 |
abort(); |
| 69 |
} |
| 70 |
}</%def> |