diff options
author | David G. Quintas <dgq@google.com> | 2015-10-13 14:37:40 -0700 |
---|---|---|
committer | David G. Quintas <dgq@google.com> | 2015-10-13 14:37:40 -0700 |
commit | bee8f104c0827bc829402d79c8302835adfc37f9 (patch) | |
tree | fcd34c4bbd954d2ecda5f84f5516746a8465acfc /tools | |
parent | ab31e936b22284d8828f87ca66b46caf9e92d254 (diff) | |
parent | 7eacdd480309d87d53ed63f5304ba1607f21f7f9 (diff) |
Merge pull request #3791 from nicolasnoble/add-c-and-cxx-coverage-reports
Adds coverage reports for C and C++.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/run_tests/post_tests_c.sh | 41 | ||||
-rwxr-xr-x | tools/run_tests/run_lcov.sh | 6 | ||||
-rwxr-xr-x | tools/run_tests/run_tests.py | 36 |
3 files changed, 80 insertions, 3 deletions
diff --git a/tools/run_tests/post_tests_c.sh b/tools/run_tests/post_tests_c.sh new file mode 100755 index 0000000000..f2f3ce9432 --- /dev/null +++ b/tools/run_tests/post_tests_c.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +if [ "$CONFIG" != "gcov" ] ; then exit ; fi + +root=$(readlink -f $(dirname $0)/../..) +out=$root/reports/c_cxx_coverage +tmp=$(mktemp) +cd $root +lcov --capture --directory . --output-file $tmp +genhtml $tmp --output-directory $out +rm $tmp diff --git a/tools/run_tests/run_lcov.sh b/tools/run_tests/run_lcov.sh index 69b1de6b89..a28ec138bb 100755 --- a/tools/run_tests/run_lcov.sh +++ b/tools/run_tests/run_lcov.sh @@ -30,10 +30,10 @@ set -ex -out=`realpath ${1:-coverage}` +out=$(readlink -f ${1:-coverage}) -root=`realpath $(dirname $0)/../..` -tmp=`mktemp` +root=$(readlink -f $(dirname $0)/../..) +tmp=$(mktemp) cd $root tools/run_tests/run_tests.py -c gcov -l c c++ || true lcov --capture --directory . --output-file $tmp diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index e9ae9f4795..ff8ad8ff78 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -179,6 +179,12 @@ class CLanguage(object): def build_steps(self): return [] + def post_tests_steps(self): + if self.platform == 'windows': + return [] + else: + return [['tools/run_tests/post_tests_c.sh']] + def makefile_name(self): return 'Makefile' @@ -204,6 +210,9 @@ class NodeLanguage(object): def build_steps(self): return [['tools/run_tests/build_node.sh']] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -229,6 +238,9 @@ class PhpLanguage(object): def build_steps(self): return [['tools/run_tests/build_php.sh']] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -276,6 +288,9 @@ class PythonLanguage(object): do_newline=True) return commands + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -301,6 +316,9 @@ class RubyLanguage(object): def build_steps(self): return [['tools/run_tests/build_ruby.sh']] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -349,6 +367,9 @@ class CSharpLanguage(object): else: return [['tools/run_tests/build_csharp.sh']] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -374,6 +395,9 @@ class ObjCLanguage(object): def build_steps(self): return [['src/objective-c/tests/build_tests.sh']] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -399,6 +423,9 @@ class Sanity(object): def build_steps(self): return [] + def post_tests_steps(self): + return [] + def makefile_name(self): return 'Makefile' @@ -637,6 +664,11 @@ build_steps.extend(set( for l in languages for cmdline in l.build_steps())) +post_tests_steps = list(set( + jobset.JobSpec(cmdline, environ={'CONFIG': cfg}) + for cfg in build_configs + for l in languages + for cmdline in l.post_tests_steps())) runs_per_test = args.runs_per_test forever = args.forever @@ -821,6 +853,10 @@ def _build_and_run( tree = ET.ElementTree(root) tree.write(xml_report, encoding='UTF-8') + if not jobset.run(post_tests_steps, maxjobs=1, stop_on_failure=True, + newline_on_success=newline_on_success, travis=travis): + return 3 + if cache: cache.save() return 0 |