Merge pull request #3791 from nicolasnoble/add-c-and-cxx-coverage-reports

Adds coverage reports for C and C++.
pull/3816/head
David G. Quintas 9 years ago
commit bee8f104c0
  1. 41
      tools/run_tests/post_tests_c.sh
  2. 6
      tools/run_tests/run_lcov.sh
  3. 36
      tools/run_tests/run_tests.py

@ -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

@ -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

@ -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

Loading…
Cancel
Save