blob: 7a6dfe3577faa6592fe5385e35bbbe6fe80ba608 [file] [log] [blame]
Craig Tiller6ec5d6f2015-09-28 12:53:05 -07001#!/usr/bin/env bash
Craig Tiller6169d5f2016-03-31 07:46:18 -07002# Copyright 2015, Google Inc.
Jan Tattermusch083466f2015-06-03 13:17:40 -07003# 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 Tattermusch8fa8c042015-06-03 14:02:07 -070030#
Jan Tattermusch083466f2015-06-03 13:17:40 -070031# This script is invoked by Jenkins and triggers a test run based on
32# env variable settings.
Jan Tattermusch8fa8c042015-06-03 14:02:07 -070033#
Nicolas "Pixel" Noble7df72082015-07-11 02:16:45 +020034# Setting up rvm environment BEFORE we set -ex.
35[[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh
Jan Tattermusch8fa8c042015-06-03 14:02:07 -070036# 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!
40set -ex -o igncr || set -ex
Jan Tattermusch083466f2015-06-03 13:17:40 -070041
42if [ "$platform" == "linux" ]
43then
Craig Tiller3ec6b952016-01-28 10:06:11 -080044 PLATFORM_SPECIFIC_ARGS="--use_docker --measure_cpu_costs"
Nicolas "Pixel" Noble4243ca82015-07-23 23:47:56 +020045elif [ "$platform" == "freebsd" ]
46then
Jan Tattermusch1961a802016-01-25 21:30:24 -080047 export MAKE=gmake
Jan Tattermusch083466f2015-06-03 13:17:40 -070048fi
Nicolas "Pixel" Noble52f6fc12015-10-08 23:25:06 +020049
Jan Tattermusch1961a802016-01-25 21:30:24 -080050unset platform # variable named 'platform' breaks the windows build
51
Craig Tiller3ec6b952016-01-28 10:06:11 -080052python 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 Tattermusch1961a802016-01-25 21:30:24 -080060
Nicolas "Pixel" Noble52f6fc12015-10-08 23:25:06 +020061if [ ! -e reports/index.html ]
62then
63 mkdir -p reports
64 echo 'No reports generated.' > reports/index.html
65fi
Craig Tillerb361b4e2016-01-06 11:44:17 -080066
67if [ "$TESTS_FAILED" != "" ]
68then
69 exit 1
70fi