qps_benchmark_script.bzl 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Copyright 2018 gRPC authors.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. #
  15. # This is for the gRPC build system. This isn't intended to be used outsite of
  16. # the BUILD file for gRPC. It contains the mapping for the template system we
  17. # use to generate other platform's build system files.
  18. #
  19. # Please consider that there should be a high bar for additions and changes to
  20. # this file.
  21. # Each rule listed must be re-written for Google's internal build system, and
  22. # each change must be ported from one to the other.
  23. #
  24. """Script to run qps benchmark."""
  25. load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
  26. load("//test/cpp/qps:qps_json_driver_scenarios.bzl", "QPS_JSON_DRIVER_SCENARIOS")
  27. load("//test/cpp/qps:json_run_localhost_scenarios.bzl", "JSON_RUN_LOCALHOST_SCENARIOS")
  28. def add_suffix(name):
  29. # NOTE(https://github.com/grpc/grpc/issues/24178): Add the suffix to the name
  30. # to avoid having the target name that 87, 88, 89 or 90 long.
  31. m = len(name) - (87 - len("//test/cpp/qps:"))
  32. if m >= 0 and m <= 3:
  33. return name + "_" * (4 - m)
  34. else:
  35. return name
  36. # buildifier: disable=unnamed-macro
  37. def qps_json_driver_batch():
  38. for scenario in QPS_JSON_DRIVER_SCENARIOS:
  39. grpc_cc_test(
  40. name = add_suffix("qps_json_driver_test_%s" % scenario),
  41. srcs = ["qps_json_driver.cc"],
  42. args = [
  43. "--run_inproc",
  44. "--scenarios_json",
  45. QPS_JSON_DRIVER_SCENARIOS[scenario],
  46. ],
  47. deps = [
  48. ":benchmark_config",
  49. ":driver_impl",
  50. "//:grpc++",
  51. "//test/cpp/util:test_config",
  52. "//test/cpp/util:test_util",
  53. ],
  54. tags = [
  55. "qps_json_driver",
  56. "no_mac",
  57. ],
  58. # TODO(b/156975956): address OOMing benchmark tests
  59. flaky = True,
  60. )
  61. # buildifier: disable=unnamed-macro
  62. def json_run_localhost_batch():
  63. for scenario in JSON_RUN_LOCALHOST_SCENARIOS:
  64. grpc_cc_test(
  65. name = add_suffix("json_run_localhost_%s" % scenario),
  66. srcs = ["json_run_localhost.cc"],
  67. args = [
  68. "--scenarios_json",
  69. JSON_RUN_LOCALHOST_SCENARIOS[scenario],
  70. ],
  71. data = [
  72. "//test/cpp/qps:qps_json_driver",
  73. "//test/cpp/qps:qps_worker",
  74. ],
  75. deps = [
  76. "//:gpr",
  77. "//test/core/util:grpc_test_util",
  78. "//test/cpp/util:test_config",
  79. "//test/cpp/util:test_util",
  80. ],
  81. tags = [
  82. "json_run_localhost",
  83. "no_windows",
  84. "no_mac",
  85. ],
  86. # TODO(b/156975956): address OOMing benchmark tests
  87. flaky = True,
  88. )