diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-08-15 13:16:31 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-08-15 08:41:52 +0000 |
commit | 9fdb97733b776c703ede41d5422a4a0c787fdad8 (patch) | |
tree | bc7b733e3f859e89b451995323d583076d0f7d86 /run_unittests.py | |
parent | 96e7ebc162010db903434a6c99276d3eea8db758 (diff) | |
download | meson-9fdb97733b776c703ede41d5422a4a0c787fdad8.zip meson-9fdb97733b776c703ede41d5422a4a0c787fdad8.tar.gz meson-9fdb97733b776c703ede41d5422a4a0c787fdad8.tar.bz2 |
ninjabackend: Fix coverage rule generation
Without the parenthesis, the command evaluates to `[]` if
`use_llvm_cov` is `False`.
Also fix tests to actually check whether or not coverage reports are
generated.
Fixes https://github.com/mesonbuild/meson/issues/7553
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 97b3b58..95a6089 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4885,6 +4885,18 @@ recommended as it is not supported on some platforms''') m = get_data_pattern(command).search(md, pos=md_command_sections[command][0], endpos=md_command_sections[command][1]) self.assertIsNotNone(m, 'Command `{}` is missing placeholders for dynamic data. Doc file: `{}`'.format(command, doc_path)) + def _check_coverage_files(self, types=('text', 'xml', 'html')): + covdir = Path(self.builddir) / 'meson-logs' + files = [] + if 'text' in types: + files.append('coverage.txt') + if 'xml' in types: + files.append('coverage.xml') + if 'html' in types: + files.append('coveragereport/index.html') + for f in files: + self.assertTrue((covdir / f).is_file(), msg='{} is not a file'.format(f)) + def test_coverage(self): if mesonbuild.environment.detect_msys2_arch(): raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2') @@ -4903,6 +4915,7 @@ recommended as it is not supported on some platforms''') self.build() self.run_tests() self.run_target('coverage') + self._check_coverage_files() def test_coverage_complex(self): if mesonbuild.environment.detect_msys2_arch(): @@ -4922,6 +4935,7 @@ recommended as it is not supported on some platforms''') self.build() self.run_tests() self.run_target('coverage') + self._check_coverage_files() def test_coverage_html(self): if mesonbuild.environment.detect_msys2_arch(): @@ -4941,6 +4955,7 @@ recommended as it is not supported on some platforms''') self.build() self.run_tests() self.run_target('coverage-html') + self._check_coverage_files(['html']) def test_coverage_text(self): if mesonbuild.environment.detect_msys2_arch(): @@ -4960,6 +4975,7 @@ recommended as it is not supported on some platforms''') self.build() self.run_tests() self.run_target('coverage-text') + self._check_coverage_files(['text']) def test_coverage_xml(self): if mesonbuild.environment.detect_msys2_arch(): @@ -4979,6 +4995,7 @@ recommended as it is not supported on some platforms''') self.build() self.run_tests() self.run_target('coverage-xml') + self._check_coverage_files(['xml']) def test_cross_file_constants(self): with temp_filename() as crossfile1, temp_filename() as crossfile2: |