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