generate_tests.bzl 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env python2.7
  2. # Copyright 2015 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. """
  16. Houses grpc_bad_ssl_tests.
  17. """
  18. load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test")
  19. def test_options():
  20. return struct()
  21. # maps test names to options
  22. BAD_SSL_TESTS = ["cert", "alpn"]
  23. # buildifier: disable=unnamed-macro
  24. def grpc_bad_ssl_tests():
  25. """Instantiates gRPC bad SSL tests."""
  26. grpc_cc_library(
  27. name = "bad_ssl_test_server",
  28. srcs = ["server_common.cc"],
  29. hdrs = ["server_common.h"],
  30. deps = [
  31. "//test/core/util:grpc_test_util",
  32. "//:grpc",
  33. ],
  34. )
  35. for t in BAD_SSL_TESTS:
  36. grpc_cc_binary(
  37. name = "bad_ssl_%s_server" % t,
  38. srcs = ["servers/%s.cc" % t],
  39. deps = [":bad_ssl_test_server"],
  40. )
  41. grpc_cc_test(
  42. name = "bad_ssl_%s_test" % t,
  43. srcs = ["bad_ssl_test.cc"],
  44. data = [
  45. ":bad_ssl_%s_server" % t,
  46. "//src/core/tsi/test_creds:badserver.key",
  47. "//src/core/tsi/test_creds:badserver.pem",
  48. "//src/core/tsi/test_creds:ca.pem",
  49. "//src/core/tsi/test_creds:server1.key",
  50. "//src/core/tsi/test_creds:server1.pem",
  51. ],
  52. deps = [
  53. "//test/core/util:grpc_test_util",
  54. "//:gpr",
  55. "//test/core/end2end:cq_verifier",
  56. ],
  57. tags = ["no_windows"],
  58. )