Craig Tiller | 6ec5d6f | 2015-09-28 12:53:05 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 15 | # |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 16 | # This script is invoked by Jenkins and triggers a test run based on |
| 17 | # env variable settings. |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 18 | # |
Nicolas "Pixel" Noble | 7df7208 | 2015-07-11 02:16:45 +0200 | [diff] [blame] | 19 | # Setting up rvm environment BEFORE we set -ex. |
| 20 | [[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 21 | # To prevent cygwin bash complaining about empty lines ending with \r |
| 22 | # we set the igncr option. The option doesn't exist on Linux, so we fallback |
| 23 | # to just 'set -ex' there. |
| 24 | # NOTE: No empty lines should appear in this file before igncr is set! |
| 25 | set -ex -o igncr || set -ex |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 26 | |
| 27 | if [ "$platform" == "linux" ] |
| 28 | then |
Craig Tiller | 3ec6b95 | 2016-01-28 10:06:11 -0800 | [diff] [blame] | 29 | PLATFORM_SPECIFIC_ARGS="--use_docker --measure_cpu_costs" |
Nicolas "Pixel" Noble | 4243ca8 | 2015-07-23 23:47:56 +0200 | [diff] [blame] | 30 | elif [ "$platform" == "freebsd" ] |
| 31 | then |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 32 | export MAKE=gmake |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 33 | fi |
Nicolas "Pixel" Noble | 52f6fc1 | 2015-10-08 23:25:06 +0200 | [diff] [blame] | 34 | |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 35 | unset platform # variable named 'platform' breaks the windows build |
| 36 | |
Craig Tiller | 3ec6b95 | 2016-01-28 10:06:11 -0800 | [diff] [blame] | 37 | python tools/run_tests/run_tests.py \ |
| 38 | $PLATFORM_SPECIFIC_ARGS \ |
| 39 | -t \ |
| 40 | -l $language \ |
| 41 | -c $config \ |
| 42 | -x report.xml \ |
| 43 | -j 2 \ |
| 44 | $@ || TESTS_FAILED="true" |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 45 | |
Nicolas "Pixel" Noble | 52f6fc1 | 2015-10-08 23:25:06 +0200 | [diff] [blame] | 46 | if [ ! -e reports/index.html ] |
| 47 | then |
| 48 | mkdir -p reports |
| 49 | echo 'No reports generated.' > reports/index.html |
| 50 | fi |
Craig Tiller | b361b4e | 2016-01-06 11:44:17 -0800 | [diff] [blame] | 51 | |
| 52 | if [ "$TESTS_FAILED" != "" ] |
| 53 | then |
| 54 | exit 1 |
| 55 | fi |