blob: 9d8b6793fce85c5669d424758b12a68d2d9f4dc4 [file] [log] [blame]
Craig Tiller934baa32015-01-12 18:19:45 -08001#!/bin/bash
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Craig Tiller83428812015-02-16 12:13:57 -08003#
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
Craig Tiller83428812015-02-16 12:13:57 -08007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Craig Tiller83428812015-02-16 12:13:57 -08009#
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.
Craig Tiller934baa32015-01-12 18:19:45 -080015
16set -ex
17
Mehrdad Afshari4da34aa2017-06-27 17:06:00 -070018out=$(readlink -f "${1:-coverage}")
Craig Tiller934baa32015-01-12 18:19:45 -080019
Mehrdad Afshari4da34aa2017-06-27 17:06:00 -070020root=$(readlink -f "$(dirname "$0")/../../..")
David G. Quintas38d02d82015-12-14 17:19:13 -080021shift || true
Nicolas "Pixel" Noble7eacdd42015-10-13 23:00:36 +020022tmp=$(mktemp)
Mehrdad Afshari4da34aa2017-06-27 17:06:00 -070023cd "$root"
24tools/run_tests/run_tests.py -c gcov -l c c++ "$@" || true
25lcov --capture --directory . --output-file "$tmp"
26genhtml "$tmp" --output-directory "$out"
27rm "$tmp"
Craig Tiller934baa32015-01-12 18:19:45 -080028if which xdg-open > /dev/null
29then
Mehrdad Afshari4da34aa2017-06-27 17:06:00 -070030 xdg-open "file://$out/index.html"
Craig Tiller934baa32015-01-12 18:19:45 -080031fi