Craig Tiller | 6ec5d6f | 2015-09-28 12:53:05 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame] | 2 | # Copyright 2015, Google Inc. |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 3 | # All rights reserved. |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are |
| 7 | # met: |
| 8 | # |
| 9 | # * Redistributions of source code must retain the above copyright |
| 10 | # notice, this list of conditions and the following disclaimer. |
| 11 | # * Redistributions in binary form must reproduce the above |
| 12 | # copyright notice, this list of conditions and the following disclaimer |
| 13 | # in the documentation and/or other materials provided with the |
| 14 | # distribution. |
| 15 | # * Neither the name of Google Inc. nor the names of its |
| 16 | # contributors may be used to endorse or promote products derived from |
| 17 | # this software without specific prior written permission. |
| 18 | # |
| 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 30 | # |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 31 | # This script is invoked by Jenkins and triggers a test run based on |
| 32 | # env variable settings. |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 33 | # |
Nicolas "Pixel" Noble | 7df7208 | 2015-07-11 02:16:45 +0200 | [diff] [blame] | 34 | # Setting up rvm environment BEFORE we set -ex. |
| 35 | [[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh |
Jan Tattermusch | 8fa8c04 | 2015-06-03 14:02:07 -0700 | [diff] [blame] | 36 | # To prevent cygwin bash complaining about empty lines ending with \r |
| 37 | # we set the igncr option. The option doesn't exist on Linux, so we fallback |
| 38 | # to just 'set -ex' there. |
| 39 | # NOTE: No empty lines should appear in this file before igncr is set! |
| 40 | set -ex -o igncr || set -ex |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 41 | |
| 42 | if [ "$platform" == "linux" ] |
| 43 | then |
Craig Tiller | 3ec6b95 | 2016-01-28 10:06:11 -0800 | [diff] [blame] | 44 | PLATFORM_SPECIFIC_ARGS="--use_docker --measure_cpu_costs" |
Nicolas "Pixel" Noble | 4243ca8 | 2015-07-23 23:47:56 +0200 | [diff] [blame] | 45 | elif [ "$platform" == "freebsd" ] |
| 46 | then |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 47 | export MAKE=gmake |
Jan Tattermusch | 083466f | 2015-06-03 13:17:40 -0700 | [diff] [blame] | 48 | fi |
Nicolas "Pixel" Noble | 52f6fc1 | 2015-10-08 23:25:06 +0200 | [diff] [blame] | 49 | |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 50 | unset platform # variable named 'platform' breaks the windows build |
| 51 | |
Craig Tiller | 3ec6b95 | 2016-01-28 10:06:11 -0800 | [diff] [blame] | 52 | python tools/run_tests/run_tests.py \ |
| 53 | $PLATFORM_SPECIFIC_ARGS \ |
| 54 | -t \ |
| 55 | -l $language \ |
| 56 | -c $config \ |
| 57 | -x report.xml \ |
| 58 | -j 2 \ |
| 59 | $@ || TESTS_FAILED="true" |
Jan Tattermusch | 1961a80 | 2016-01-25 21:30:24 -0800 | [diff] [blame] | 60 | |
Nicolas "Pixel" Noble | 52f6fc1 | 2015-10-08 23:25:06 +0200 | [diff] [blame] | 61 | if [ ! -e reports/index.html ] |
| 62 | then |
| 63 | mkdir -p reports |
| 64 | echo 'No reports generated.' > reports/index.html |
| 65 | fi |
Craig Tiller | b361b4e | 2016-01-06 11:44:17 -0800 | [diff] [blame] | 66 | |
| 67 | if [ "$TESTS_FAILED" != "" ] |
| 68 | then |
| 69 | exit 1 |
| 70 | fi |