Skip to content

Commit

Permalink
core: e2e: allow running without any hanresses present
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <david@adalogics.com>
  • Loading branch information
DavidKorczynski committed Dec 29, 2024
1 parent c19b7d9 commit 54abc73
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/fuzz_introspector/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def load_data_files(self, parallelise=True, correlation_file=None):
parallelise)

logger.info(f"Found {len(self.profiles)} profiles")
if len(self.profiles) == 0:
logger.info("Found no profiles")
raise DataLoaderError("No fuzzer profiles")
#if len(self.profiles) == 0:
# logger.info("Found no profiles")
# raise DataLoaderError("No fuzzer profiles")

self.input_bugs = data_loader.try_load_input_bugs()
correlation_dict = utils.data_file_read_yaml(correlation_file)
Expand Down
1 change: 1 addition & 0 deletions src/fuzz_introspector/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def get_cmdline_parser() -> argparse.ArgumentParser:
full_parser = subparsers.add_parser('full', help='End to end run')
full_parser.add_argument('--target_dir')
full_parser.add_argument('--language')
full_parser.add_argument('--module-only', action='store_true')

# Report generation command
report_parser = subparsers.add_parser(
Expand Down
11 changes: 9 additions & 2 deletions src/fuzz_introspector/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@ def correlate_binaries_to_logs(binaries_dir: str) -> int:
def end_to_end(args) -> int:
"""Runs both frontend and backend."""
oss_fuzz.analyse_folder(args.language, args.target_dir,
'LLVMFuzzerTestOneInput')

'LLVMFuzzerTestOneInput',
module_only=args.module_only)

if args.module_only:
if os.path.isfile('report.yaml'):
shutil.copy('report.yaml', 'fuzzerLogFile-1.data.yaml')
with open('fuzzerLogFile-1.data', 'w') as f:
f.write("Call tree\n")
f.write("====================================")
if 'c' in args.language:
language = 'c-cpp'
else:
Expand Down
2 changes: 1 addition & 1 deletion src/fuzz_introspector/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def read_fuzzer_data_file_to_profile(

if not profile.has_entry_point():
logger.info("Found no entrypoints")
return None
#return None
logger.info("Returning profile")
return profile

Expand Down
4 changes: 2 additions & 2 deletions src/fuzz_introspector/datatypes/fuzzer_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ def _set_all_reached_functions(self) -> None:
self.all_class_functions[entrypoint].functions_reached)
self.functions_reached_by_fuzzer.append(entrypoint)
return

raise DataLoaderError("Can not identify entrypoint")
self.functions_reached_by_fuzzer = []
#raise DataLoaderError("Can not identify entrypoint")

def _set_all_unreached_functions(self) -> None:
"""Sets self.functions_unreached_by_fuzzer to all functions that are
Expand Down
2 changes: 2 additions & 0 deletions src/fuzz_introspector/datatypes/project_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def target_lang(self):
if len(set_of_targets) > 1:
raise exceptions.AnalysisError(
"Project has fuzzers with multiple targets")
if len(set_of_targets) == 0:
return 'c-cpp'
return set_of_targets.pop()

@property
Expand Down
2 changes: 2 additions & 0 deletions src/fuzz_introspector/html_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def html_get_table_of_contents(
cov_index = "report.html"
elif proj_profile.target_lang == "go":
cov_index = "index.html"
else:
cov_index = 'report.html'

html_toc_string = ""
html_toc_string += f"""<div class="left-sidebar">\
Expand Down

0 comments on commit 54abc73

Please sign in to comment.