aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-07-16 09:53:18 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2020-07-28 17:59:03 +0300
commit903d5dd8a7dc1d6f8bef79e66d6ebc07ca2956a8 (patch)
treed6e8619d489bf10137cc3f399b8b2e76a645011e /run_unittests.py
parent18aff92d7a9f110cc3c790c61c2ced85b8d81a26 (diff)
downloadmeson-903d5dd8a7dc1d6f8bef79e66d6ebc07ca2956a8.zip
meson-903d5dd8a7dc1d6f8bef79e66d6ebc07ca2956a8.tar.gz
meson-903d5dd8a7dc1d6f8bef79e66d6ebc07ca2956a8.tar.bz2
ninjabackend: check if target has compiler attribute
otherwise we are getting errors like: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/mesonbuild/mesonmain.py", line 131, in run return options.run_func(options) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/msetup.py", line 215, in _generate intr.backend.generate() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 518, in generate self.generate_coverage_rules() File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 991, in generate_coverage_rules self.generate_coverage_command(e, []) File "/usr/local/lib/python3.6/dist-packages/mesonbuild/backend/ninjabackend.py", line 975, in generate_coverage_command for compiler in target.compilers.values(): AttributeError: 'RunTarget' object has no attribute 'compilers' This extends the 109 generatecode test case to also define a test, so coverage can really detect something.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index fac0f50..b5294b9 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1272,7 +1272,6 @@ class InternalTests(unittest.TestCase):
self.assertFalse(errors)
-
@unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
class DataTests(unittest.TestCase):
@@ -4905,6 +4904,25 @@ recommended as it is not supported on some platforms''')
self.run_tests()
self.run_target('coverage')
+ def test_coverage_complex(self):
+ if mesonbuild.environment.detect_msys2_arch():
+ raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
+ gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
+ if not gcovr_exe:
+ raise unittest.SkipTest('gcovr not found, or too old')
+ testdir = os.path.join(self.common_test_dir, '109 generatorcustom')
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ cc = env.detect_c_compiler(MachineChoice.HOST)
+ if cc.get_id() == 'clang':
+ if not mesonbuild.environment.detect_llvm_cov():
+ raise unittest.SkipTest('llvm-cov not found')
+ if cc.get_id() == 'msvc':
+ raise unittest.SkipTest('Test only applies to non-MSVC compilers')
+ self.init(testdir, extra_args=['-Db_coverage=true'])
+ self.build()
+ self.run_tests()
+ self.run_target('coverage')
+
def test_coverage_html(self):
if mesonbuild.environment.detect_msys2_arch():
raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')