Home | History | Annotate | Download | only in end2end
      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 #include "test/core/util/debugger_macros.h"
     31 
     32 static bool g_pre_init_called = false;
     33 
     34 % for test in tests:
     35 extern void ${test}(grpc_end2end_test_config config);
     36 extern void ${test}_pre_init(void);
     37 % endfor
     38 
     39 void grpc_end2end_tests_pre_init(void) {
     40   GPR_ASSERT(!g_pre_init_called);
     41   g_pre_init_called = true;
     42   grpc_summon_debugger_macros();
     43 % for test in tests:
     44   ${test}_pre_init();
     45 % endfor
     46 }
     47 
     48 void grpc_end2end_tests(int argc, char **argv,
     49                         grpc_end2end_test_config config) {
     50   int i;
     51 
     52   GPR_ASSERT(g_pre_init_called);
     53 
     54   if (argc <= 1) {
     55 % for test in tests:
     56     ${test}(config);
     57 % endfor
     58     return;
     59   }
     60 
     61   for (i = 1; i < argc; i++) {
     62 % for test in tests:
     63     if (0 == strcmp("${test}", argv[i])) {
     64       ${test}(config);
     65       continue;
     66     }
     67 % endfor
     68     gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
     69     abort();
     70   }
     71 }</%def>
     72