blob: df9d3d1ca27f4826e54de0d6f0aa67ccfe0684fe [file] [log] [blame]
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +02001#!/bin/bash
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +02003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# 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
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +02007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +02009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# 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.
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +020015#
Jan Tattermusch8266c672015-09-17 09:18:03 -070016# This script is invoked by build_docker_and_run_tests.sh inside a docker
Jan Tattermuschc95eead2015-09-18 13:03:50 -070017# container. You should never need to call this script on your own.
Jan Tattermusch320bd612015-09-15 12:44:35 -070018
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +020019set -e
20
21export CONFIG=$config
Craig Tiller1c8fc732016-03-24 00:30:24 -070022export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
yang-g6ce4d0b2016-05-12 16:43:17 -070023export PATH=$PATH:/usr/bin/llvm-symbolizer
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +020024
Masood Malekghassemi60e5f912015-10-05 15:26:26 -070025# Ensure that programs depending on current-user-ownership of cache directories
26# are satisfied (it's being mounted from outside the image).
Mehrdad Afshari8d2ee382018-01-18 13:12:26 -080027chown "$(whoami)" "$XDG_CACHE_HOME"
Masood Malekghassemi60e5f912015-10-05 15:26:26 -070028
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +020029mkdir -p /var/local/git
Matt Kwong66a1eea2016-09-29 18:30:19 -070030git clone /var/local/jenkins/grpc /var/local/git/grpc
31# clone gRPC submodules, use data from locally cloned submodules where possible
Mehrdad Afshari8d2ee382018-01-18 13:12:26 -080032# TODO: figure out a way to eliminate this shellcheck suppression:
33# shellcheck disable=SC2016,SC1004
Matt Kwong66a1eea2016-09-29 18:30:19 -070034(cd /var/local/jenkins/grpc/ && git submodule foreach 'cd /var/local/git/grpc \
35&& git submodule update --init --reference /var/local/jenkins/grpc/${name} \
36${name}')
Nicolas "Pixel" Noble964f9552015-06-25 02:01:27 +020037
Nicolas "Pixel" Noble4d977072015-10-02 23:52:38 +020038mkdir -p reports
39
Craig Tillerd14d1032016-02-24 15:39:55 -080040$POST_GIT_STEP
41
Nicolas "Pixel" Noble61059d32015-12-02 01:45:45 +010042exit_code=0
43
44$RUN_TESTS_COMMAND || exit_code=$?
Nicolas "Pixel" Noble4d977072015-10-02 23:52:38 +020045
46cd reports
47echo '<html><head></head><body>' > index.html
48find . -maxdepth 1 -mindepth 1 -type d | sort | while read d ; do
49 d=${d#*/}
50 n=${d//_/ }
51 echo "<a href='$d/index.html'>$n</a><br />" >> index.html
52done
53echo '</body></html>' >> index.html
54cd ..
55
56zip -r reports.zip reports
Mehrdad Afshari8d2ee382018-01-18 13:12:26 -080057find . -name report.xml -print0 | xargs -0 -r zip reports.zip
58find . -name sponge_log.xml -print0 | xargs -0 -r zip reports.zip
59find . -name 'report_*.xml' -print0 | xargs -0 -r zip reports.zip
Nicolas "Pixel" Noble61059d32015-12-02 01:45:45 +010060
61exit $exit_code