Skip to content

Commit

Permalink
[nrf fromlist] scripts: pylib: twister: twisterlib: prevent empty gcd…
Browse files Browse the repository at this point in the history
…a files

In case of problem with parsing hex data from coverage dump,
do not create empty gcda file.
Such empty file will break gcovr parsing.

Upstream PR: zephyrproject-rtos/zephyr#70297

Signed-off-by: Piotr Kosycarz <[email protected]>
  • Loading branch information
nordic-piks authored and nordicjm committed Mar 22, 2024
1 parent a8da6e4 commit 38cf979
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/pylib/twister/twisterlib/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ def create_gcda_files(extracted_coverage_info):
continue

try:
hex_bytes = bytes.fromhex(hexdump_val)
with open(filename, 'wb') as fp:
fp.write(bytes.fromhex(hexdump_val))
fp.write(hex_bytes)
except ValueError:
logger.exception("Unable to convert hex data for file: {}".format(filename))
gcda_created = False
Expand Down

0 comments on commit 38cf979

Please sign in to comment.