Skip to content

Commit ab1e2d9

Browse files
amcneli-schwartz
authored andcommitted
coverage.py: Guard use of --html-nested behind version check.
`--html-nested` was added to gcovr in version 6.0 so passing it to versions before this will result in gcovr complaining that it doesn't recognise the argument. Added a version check to ensure that we pass a recognised argument for versions before 6.0 Fixes mesonbuild#13781 (cherry picked from commit 4c7226e)
1 parent 60c3c14 commit ab1e2d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mesonbuild/scripts/coverage.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,14 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
159159
htmloutdir = os.path.join(log_dir, 'coveragereport')
160160
if not os.path.isdir(htmloutdir):
161161
os.mkdir(htmloutdir)
162+
# Use `--html-details` if gcovr version < 6.0, otherwise
163+
# use `--html-nested`.
164+
html_arg = '--html-details'
165+
if mesonlib.version_compare(gcovr_version, '>=6.0'):
166+
html_arg = '--html-nested'
162167
subprocess.check_call(gcovr_base_cmd + gcovr_config +
163168
['--html',
164-
'--html-nested',
169+
html_arg,
165170
'--print-summary',
166171
'-o', os.path.join(htmloutdir, 'index.html'),
167172
] + gcov_exe_args)

0 commit comments

Comments
 (0)