diff options
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 20 | ||||
-rw-r--r-- | test cases/common/109 generatorcustom/meson.build | 4 |
3 files changed, 24 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3b4a4bd..32fb8db 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -972,6 +972,8 @@ int dummy; targets = self.build.get_targets().values() use_llvm_cov = False for target in targets: + if not hasattr(target, 'compilers'): + continue for compiler in target.compilers.values(): if compiler.get_id() == 'clang' and not compiler.info.is_darwin(): use_llvm_cov = True 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') diff --git a/test cases/common/109 generatorcustom/meson.build b/test cases/common/109 generatorcustom/meson.build index 17d27e5..b3f50bb 100644 --- a/test cases/common/109 generatorcustom/meson.build +++ b/test cases/common/109 generatorcustom/meson.build @@ -14,5 +14,7 @@ allinone = custom_target('alltogether', output : 'alltogether.h', command : [catter, '@INPUT@', '@OUTPUT@']) -executable('proggie', 'main.c', allinone) +proggie = executable('proggie', 'main.c', allinone) + +test('proggie', proggie) |