end2end_defs.include 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. <% tests = sorted(tests) %>\
  20. /* This file is auto-generated */
  21. #include "test/core/end2end/end2end_tests.h"
  22. #include <stdbool.h>
  23. #include <string.h>
  24. #include <grpc/support/log.h>
  25. static bool g_pre_init_called = false;
  26. % for test in tests:
  27. extern void ${test}(grpc_end2end_test_config config);
  28. extern void ${test}_pre_init(void);
  29. % endfor
  30. void grpc_end2end_tests_pre_init(void) {
  31. GPR_ASSERT(!g_pre_init_called);
  32. g_pre_init_called = true;
  33. % for test in tests:
  34. ${test}_pre_init();
  35. % endfor
  36. }
  37. // NOLINTNEXTLINE(readability-function-size)
  38. void grpc_end2end_tests(int argc, char **argv,
  39. grpc_end2end_test_config config) {
  40. int i;
  41. GPR_ASSERT(g_pre_init_called);
  42. if (argc <= 1) {
  43. % for test in tests:
  44. ${test}(config);
  45. % endfor
  46. return;
  47. }
  48. for (i = 1; i < argc; i++) {
  49. % for test in tests:
  50. if (0 == strcmp("${test}", argv[i])) {
  51. ${test}(config);
  52. continue;
  53. }
  54. % endfor
  55. gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]);
  56. abort();
  57. }
  58. }</%def>