Adds coverage reports for C and C++.

pull/3791/head
Nicolas "Pixel" Noble 9 years ago
parent 8aad5a07bf
commit 3fcd3bf8f3
  1. 42
      tools/run_tests/post_tests_c.sh
  2. 4
      tools/run_tests/run_lcov.sh
  3. 33
      tools/run_tests/run_tests.py

@ -0,0 +1,42 @@
#!/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
tools/run_tests/run_tests.py -c gcov -l c c++ || true
lcov --capture --directory . --output-file $tmp
genhtml $tmp --output-directory $out
rm $tmp

@ -30,9 +30,9 @@
set -ex
out=`realpath ${1:-coverage}`
out=`readlink -f ${1:-coverage}`
root=`realpath $(dirname $0)/../..`
root=`readlink -f $(dirname $0)/../..`
tmp=`mktemp`
cd $root
tools/run_tests/run_tests.py -c gcov -l c c++ || true

@ -175,6 +175,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'
@ -199,6 +205,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'
@ -224,6 +233,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'
@ -270,6 +282,9 @@ class PythonLanguage(object):
do_newline=True)
return commands
def post_tests_steps(self):
return []
def makefile_name(self):
return 'Makefile'
@ -295,6 +310,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'
@ -343,6 +361,9 @@ class CSharpLanguage(object):
else:
return [['tools/run_tests/build_csharp.sh']]
def post_tests_steps(self):
return []
def makefile_name(self):
return 'Makefile'
@ -368,6 +389,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'
@ -631,6 +655,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
@ -788,6 +817,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

Loading…
Cancel
Save