Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [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 |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [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. |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 15 | # |
Jan Tattermusch | 8266c67 | 2015-09-17 09:18:03 -0700 | [diff] [blame] | 16 | # This script is invoked by build_docker_and_run_tests.sh inside a docker |
Jan Tattermusch | c95eead | 2015-09-18 13:03:50 -0700 | [diff] [blame] | 17 | # container. You should never need to call this script on your own. |
Jan Tattermusch | 320bd61 | 2015-09-15 12:44:35 -0700 | [diff] [blame] | 18 | |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 19 | set -e |
| 20 | |
| 21 | export CONFIG=$config |
Craig Tiller | 1c8fc73 | 2016-03-24 00:30:24 -0700 | [diff] [blame] | 22 | export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer |
yang-g | 6ce4d0b | 2016-05-12 16:43:17 -0700 | [diff] [blame] | 23 | export PATH=$PATH:/usr/bin/llvm-symbolizer |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 24 | |
Masood Malekghassemi | 60e5f91 | 2015-10-05 15:26:26 -0700 | [diff] [blame] | 25 | # Ensure that programs depending on current-user-ownership of cache directories |
| 26 | # are satisfied (it's being mounted from outside the image). |
Mehrdad Afshari | 8d2ee38 | 2018-01-18 13:12:26 -0800 | [diff] [blame] | 27 | chown "$(whoami)" "$XDG_CACHE_HOME" |
Masood Malekghassemi | 60e5f91 | 2015-10-05 15:26:26 -0700 | [diff] [blame] | 28 | |
Nicolas "Pixel" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 29 | mkdir -p /var/local/git |
Matt Kwong | 66a1eea | 2016-09-29 18:30:19 -0700 | [diff] [blame] | 30 | git clone /var/local/jenkins/grpc /var/local/git/grpc |
| 31 | # clone gRPC submodules, use data from locally cloned submodules where possible |
Mehrdad Afshari | 8d2ee38 | 2018-01-18 13:12:26 -0800 | [diff] [blame] | 32 | # TODO: figure out a way to eliminate this shellcheck suppression: |
| 33 | # shellcheck disable=SC2016,SC1004 |
Matt Kwong | 66a1eea | 2016-09-29 18:30:19 -0700 | [diff] [blame] | 34 | (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" Noble | 964f955 | 2015-06-25 02:01:27 +0200 | [diff] [blame] | 37 | |
Nicolas "Pixel" Noble | 4d97707 | 2015-10-02 23:52:38 +0200 | [diff] [blame] | 38 | mkdir -p reports |
| 39 | |
Craig Tiller | d14d103 | 2016-02-24 15:39:55 -0800 | [diff] [blame] | 40 | $POST_GIT_STEP |
| 41 | |
Nicolas "Pixel" Noble | 61059d3 | 2015-12-02 01:45:45 +0100 | [diff] [blame] | 42 | exit_code=0 |
| 43 | |
| 44 | $RUN_TESTS_COMMAND || exit_code=$? |
Nicolas "Pixel" Noble | 4d97707 | 2015-10-02 23:52:38 +0200 | [diff] [blame] | 45 | |
| 46 | cd reports |
| 47 | echo '<html><head></head><body>' > index.html |
| 48 | find . -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 |
| 52 | done |
| 53 | echo '</body></html>' >> index.html |
| 54 | cd .. |
| 55 | |
| 56 | zip -r reports.zip reports |
Mehrdad Afshari | 8d2ee38 | 2018-01-18 13:12:26 -0800 | [diff] [blame] | 57 | find . -name report.xml -print0 | xargs -0 -r zip reports.zip |
| 58 | find . -name sponge_log.xml -print0 | xargs -0 -r zip reports.zip |
| 59 | find . -name 'report_*.xml' -print0 | xargs -0 -r zip reports.zip |
Nicolas "Pixel" Noble | 61059d3 | 2015-12-02 01:45:45 +0100 | [diff] [blame] | 60 | |
| 61 | exit $exit_code |