aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-08-18 15:31:13 +0300
committerNirbheek Chauhan <nirbheek@centricular.com>2017-09-04 16:34:35 +0530
commit46209bb68ef9b854944703a7331b5c4e9da13e29 (patch)
tree3f2e6b565ce48f8e22a66bd42cdf843cf3902a8a
parent97065a225253d0f166814d920fd64c85daa252a5 (diff)
downloadmeson-46209bb68ef9b854944703a7331b5c4e9da13e29.zip
meson-46209bb68ef9b854944703a7331b5c4e9da13e29.tar.gz
meson-46209bb68ef9b854944703a7331b5c4e9da13e29.tar.bz2
Fix coverage target breakage and add a test for it.
-rw-r--r--ciimage/Dockerfile1
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rwxr-xr-xrun_unittests.py13
3 files changed, 15 insertions, 1 deletions
diff --git a/ciimage/Dockerfile b/ciimage/Dockerfile
index 3789e8d..0ed1e01 100644
--- a/ciimage/Dockerfile
+++ b/ciimage/Dockerfile
@@ -10,4 +10,5 @@ RUN apt-get -y update && apt-get -y upgrade \
&& apt-get -y install python3-pip libxml2-dev libxslt1-dev cmake libyaml-dev \
&& apt-get -y install openmpi-bin libopenmpi-dev \
&& apt-get -y install libvulkan-dev libpcap-dev \
+&& apt-get -y install gcovr lcov \
&& python3 -m pip install hotdoc codecov
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 2d2c034..f695ce1 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -629,7 +629,7 @@ int dummy;
added_rule = True
htmloutdir = os.path.join(self.environment.get_log_dir(), 'coveragereport')
covinfo = os.path.join(self.environment.get_log_dir(), 'coverage.info')
- phony_elem = NinjaBuildElement(self.all_outputs, 'coverage-html', 'phony', os.path.join(htmloutdir, 'index.html'))
+ phony_elem = NinjaBuildElement(self.all_outputs, 'meson-coverage-html', 'phony', os.path.join(htmloutdir, 'index.html'))
phony_elem.write(outfile)
# Alias that runs the target defined above
self.create_target_alias('meson-coverage-html', outfile)
diff --git a/run_unittests.py b/run_unittests.py
index 666777d..1fb1b4b 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1910,6 +1910,19 @@ class LinuxlikeTests(BasePlatformTests):
for i in compdb:
self.assertIn("-fsanitize=address", i["command"])
+ def test_coverage(self):
+ if not shutil.which('gcovr'):
+ raise unittest.SkipTest('gcovr not found')
+ if not shutil.which('genhtml'):
+ raise unittest.SkipTest('genhtml not found')
+ if 'clang' in os.environ.get('CC', '') and os.environ.get('TRAVIS_OS_NAME', '') == 'linux':
+ raise unittest.SkipTest('Gcovr has a bug and does not work with Clang in the CI environment.')
+ testdir = os.path.join(self.common_test_dir, '1 trivial')
+ self.init(testdir, ['-Db_coverage=true'])
+ self.build()
+ self.run_tests()
+ self.run_target('coverage-html')
+
class LinuxArmCrossCompileTests(BasePlatformTests):
'''
Tests that verify cross-compilation to Linux/ARM