build_performance.sh 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  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. # shellcheck disable=SC1090
  16. source ~/.rvm/scripts/rvm
  17. set -ex
  18. cd "$(dirname "$0")/../../.."
  19. bazel=$(pwd)/tools/bazel
  20. CONFIG=${CONFIG:-opt}
  21. # build C++ qps worker & driver always - we need at least the driver to
  22. # run any of the scenarios.
  23. # TODO(jtattermusch): C++ worker and driver are not buildable on Windows yet
  24. if [ "$OSTYPE" != "msys" ]
  25. then
  26. # build C++ with cmake as building with "make" disables boringssl assembly
  27. # optimizations that can have huge impact on secure channel throughput.
  28. mkdir -p cmake/build
  29. cd cmake/build
  30. cmake -DgRPC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release ../..
  31. make qps_worker qps_json_driver -j8
  32. cd ../..
  33. # unbreak subsequent make builds by restoring zconf.h (previously renamed by cmake build)
  34. # See https://github.com/grpc/grpc/issues/11581
  35. (cd third_party/zlib; git checkout zconf.h)
  36. fi
  37. PHP_ALREADY_BUILT=""
  38. for language in "$@"
  39. do
  40. case "$language" in
  41. "c++")
  42. ;; # C++ has already been built.
  43. "java")
  44. (cd ../grpc-java/ &&
  45. ./gradlew -PskipCodegen=true -PskipAndroid=true :grpc-benchmarks:installDist)
  46. ;;
  47. "go")
  48. tools/run_tests/performance/build_performance_go.sh
  49. ;;
  50. "php7"|"php7_protobuf_c")
  51. if [ -n "$PHP_ALREADY_BUILT" ]; then
  52. echo "Skipping PHP build as already built by $PHP_ALREADY_BUILT"
  53. else
  54. PHP_ALREADY_BUILT=$language
  55. tools/run_tests/performance/build_performance_php7.sh
  56. fi
  57. ;;
  58. "csharp")
  59. python tools/run_tests/run_tests.py -l "$language" -c "$CONFIG" --build_only -j 8
  60. # unbreak subsequent make builds by restoring zconf.h (previously renamed by cmake portion of C#'s build)
  61. # See https://github.com/grpc/grpc/issues/11581
  62. (cd third_party/zlib; git checkout zconf.h)
  63. ;;
  64. "node"|"node_purejs")
  65. tools/run_tests/performance/build_performance_node.sh
  66. ;;
  67. "python")
  68. $bazel build -c opt //src/python/grpcio_tests/tests/qps:qps_worker
  69. ;;
  70. "python_asyncio")
  71. $bazel build -c opt //src/python/grpcio_tests/tests_aio/benchmark:worker
  72. ;;
  73. *)
  74. python tools/run_tests/run_tests.py -l "$language" -c "$CONFIG" --build_only -j 8
  75. ;;
  76. esac
  77. done