diff options
author | Alois Wohlschlager <alois1@gmx-topmail.de> | 2021-07-30 11:10:12 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-08-04 20:31:35 +0200 |
commit | 40d5a38d1b92826c46230e971524053d14a68ae4 (patch) | |
tree | 4d7c90320981b7635dd4cbbda0500f24123a120c /mesonbuild | |
parent | 3c3fa0a12c68da8966410ad9bacd1148dc8bd65d (diff) | |
download | meson-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 'mesonbuild')
-rw-r--r-- | mesonbuild/scripts/coverage.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py index 2bd93e8..a9e83c2 100644 --- a/mesonbuild/scripts/coverage.py +++ b/mesonbuild/scripts/coverage.py @@ -14,7 +14,7 @@ from mesonbuild import environment, mesonlib -import argparse, sys, os, subprocess, pathlib, stat +import argparse, re, sys, os, subprocess, pathlib, stat import typing as T def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build_root: str, log_dir: str, use_llvm_cov: bool) -> int: @@ -38,7 +38,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build if gcovr_exe: subprocess.check_call(gcovr_base_cmd + ['-x', - '-e', subproject_root, + '-e', re.escape(subproject_root), '-o', os.path.join(log_dir, 'coverage.xml') ] + gcov_exe_args) outfiles.append(('Xml', pathlib.Path(log_dir, 'coverage.xml'))) @@ -51,7 +51,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build subprocess.check_call(gcovr_base_cmd + ['--sonarqube', '-o', os.path.join(log_dir, 'sonarqube.xml'), - '-e', subproject_root + '-e', re.escape(subproject_root) ] + gcov_exe_args) outfiles.append(('Sonarqube', pathlib.Path(log_dir, 'sonarqube.xml'))) elif outputs: @@ -61,7 +61,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build if not outputs or 'text' in outputs: if gcovr_exe: subprocess.check_call(gcovr_base_cmd + - ['-e', subproject_root, + ['-e', re.escape(subproject_root), '-o', os.path.join(log_dir, 'coverage.txt') ] + gcov_exe_args) outfiles.append(('Text', pathlib.Path(log_dir, 'coverage.txt'))) @@ -140,7 +140,7 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build ['--html', '--html-details', '--print-summary', - '-e', subproject_root, + '-e', re.escape(subproject_root), '-o', os.path.join(htmloutdir, 'index.html'), ]) outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html'))) |