Skip to content

Commit

Permalink
scripts: pylib: twister: twisterlib: prevent empty gcda files
Browse files Browse the repository at this point in the history
In case of problem with parsing hex data from coverage dump,
do not create empty gcda file.
Such empty file will break gcovr parsing.

Signed-off-by: Piotr Kosycarz <[email protected]>
  • Loading branch information
nordic-piks authored and carlescufi committed Sep 19, 2024
1 parent 033cbba commit ca770db
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 @@ -122,8 +122,9 @@ def create_gcda_files(self, extracted_coverage_info):

try:
hexdump_val = self.merge_hexdumps(hexdumps)
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 ca770db

Please sign in to comment.