aboutsummaryrefslogtreecommitdiff
path: root/unittests/allplatformstests.py
diff options
context:
space:
mode:
authorAlois Wohlschlager <alois1@gmx-topmail.de>2021-07-30 11:10:12 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-08-04 20:31:35 +0200
commit40d5a38d1b92826c46230e971524053d14a68ae4 (patch)
tree4d7c90320981b7635dd4cbbda0500f24123a120c /unittests/allplatformstests.py
parent3c3fa0a12c68da8966410ad9bacd1148dc8bd65d (diff)
downloadmeson-40d5a38d1b92826c46230e971524053d14a68ae4.zip
meson-40d5a38d1b92826c46230e971524053d14a68ae4.tar.gz
meson-40d5a38d1b92826c46230e971524053d14a68ae4.tar.bz2
Escape path in exclude filter passed to gcovr
Gcovr interprets exclude filters, as passed to the -e option, as regexes. Since we want to exclude a raw path, the argument must be escaped.
Diffstat (limited to 'unittests/allplatformstests.py')
-rw-r--r--unittests/allplatformstests.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index a94d9cb..bd1e3fa 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -3434,6 +3434,26 @@ class AllPlatformTests(BasePlatformTests):
self.run_target('coverage-xml')
self._check_coverage_files(['xml'])
+ def test_coverage_escaping(self):
+ if mesonbuild.environment.detect_msys2_arch():
+ raise SkipTest('Skipped due to problems with coverage on MSYS2')
+ gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
+ if not gcovr_exe:
+ raise SkipTest('gcovr not found, or too old')
+ testdir = os.path.join(self.common_test_dir, '243 escape++')
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ cc = detect_c_compiler(env, MachineChoice.HOST)
+ if cc.get_id() == 'clang':
+ if not mesonbuild.environment.detect_llvm_cov():
+ raise SkipTest('llvm-cov not found')
+ if cc.get_id() == 'msvc':
+ raise 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')
+ self._check_coverage_files()
+
def test_cross_file_constants(self):
with temp_filename() as crossfile1, temp_filename() as crossfile2:
with open(crossfile1, 'w', encoding='utf-8') as f: