Skip to content

Commit

Permalink
Prevent FileNotFoundError crash
Browse files Browse the repository at this point in the history
  • Loading branch information
DonggeLiu committed Aug 12, 2024
1 parent 4eb4f3b commit 3f833da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion experiment/measurer/coverage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def generate_coverage_summary_json(self):
self.merged_profdata_file,
self.merged_summary_json_file,
summary_only=False)
if result.retcode != 0:
if result is None or result.retcode != 0:
logger.error(
'Merged coverage summary json file generation failed for '
f'fuzzer: {self.fuzzer},benchmark: {self.benchmark}.')
Expand Down Expand Up @@ -276,6 +276,10 @@ def generate_json_summary(coverage_binary,

if summary_only:
command.append('-summary-only')
if not os.path.exists(output_file):
logger.error(
f'Coverage summary json file defective or missing: {output_file}')
return None

with open(output_file, 'w', encoding='utf-8') as dst_file:
result = new_process.execute(command,
Expand Down

0 comments on commit 3f833da

Please sign in to comment.