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 31static bool g_pre_init_called = false; 32 33% for test in tests: 34extern void ${test}(grpc_end2end_test_config config); 35extern void ${test}_pre_init(void); 36% endfor 37 38void 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 46void grpc_end2end_tests(int argc, char **argv, 47 grpc_end2end_test_config config) { 48 int i; 49 50 GPR_ASSERT(g_pre_init_called); 51 52 if (argc <= 1) { 53% for test in tests: 54 ${test}(config); 55% endfor 56 return; 57 } 58 59 for (i = 1; i < argc; i++) { 60% for test in tests: 61 if (0 == strcmp("${test}", argv[i])) { 62 ${test}(config); 63 continue; 64 } 65% endfor 66 gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); 67 abort(); 68 } 69}</%def> 70