check_qps_scenario_changes.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. # Copyright 2018 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. import os
  16. import subprocess
  17. import sys
  18. os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '../../../test/cpp/qps'))
  19. subprocess.check_call(['./json_run_localhost_scenario_gen.py'])
  20. subprocess.check_call(['./qps_json_driver_scenario_gen.py'])
  21. subprocess.check_call(['buildifier', '-v', '-r', '.'])
  22. output = subprocess.check_output(['git', 'status', '--porcelain']).decode()
  23. qps_json_driver_bzl = 'test/cpp/qps/qps_json_driver_scenarios.bzl'
  24. json_run_localhost_bzl = 'test/cpp/qps/json_run_localhost_scenarios.bzl'
  25. if qps_json_driver_bzl in output or json_run_localhost_bzl in output:
  26. print('qps benchmark scenarios have been updated, please commit '
  27. 'test/cpp/qps/qps_json_driver_scenarios.bzl and/or '
  28. 'test/cpp/qps/json_run_localhost_scenarios.bzl')
  29. sys.exit(1)