Skip to content

Commit

Permalink
coverage.py: Guard use of --html-nested behind version check.
Browse files Browse the repository at this point in the history
`--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 #13781
  • Loading branch information
amcn authored and eli-schwartz committed Nov 5, 2024
1 parent 273894d commit 4c7226e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mesonbuild/scripts/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,14 @@ def coverage(outputs: T.List[str], source_root: str, subproject_root: str, build
htmloutdir = os.path.join(log_dir, 'coveragereport')
if not os.path.isdir(htmloutdir):
os.mkdir(htmloutdir)
# Use `--html-details` if gcovr version < 6.0, otherwise
# use `--html-nested`.
html_arg = '--html-details'
if mesonlib.version_compare(gcovr_version, '>=6.0'):
html_arg = '--html-nested'
subprocess.check_call(gcovr_base_cmd + gcovr_config +
['--html',
'--html-nested',
html_arg,
'--print-summary',
'-o', os.path.join(htmloutdir, 'index.html'),
] + gcov_exe_args)
Expand Down

0 comments on commit 4c7226e

Please sign in to comment.