Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return fuzzer return code from main #351

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion bin/deepstate/core/fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __init__(self, envvar: str) -> None:
- stats_file (file where to put stats from fuzzer in common format)
- output_file (file where stdout of fuzzer will be redirected)
- proc (handler to fuzzer process)
- fuzzer_return_code (the exit status from the fuzzer process AND the return status of main)

- push_dir (push testcases from external sources here)
- pull_dir (pull new testcases from this dir)
Expand Down Expand Up @@ -95,6 +96,7 @@ def __init__(self, envvar: str) -> None:
self._on: bool = False

self.proc: subprocess.Popen[bytes]
self.fuzzer_return_code = 0
self.require_seeds: bool = False
self.stats_file: str = "deepstate-stats.txt"
self.output_file: str = "fuzzer-output.txt"
Expand Down Expand Up @@ -570,7 +572,7 @@ def main(self):
try:
self.parse_args()
self.run()
return 0
return self.fuzzer_return_code
except AnalysisBackendError as e:
L.error(e)
return 1
Expand Down Expand Up @@ -716,13 +718,15 @@ def run(self, runner: Optional[str] = None, no_exec: bool = False):
(self.proc.returncode == 1 and self.name == "libFuzzer"):
L.info("Fuzzer %s (PID %d) exited with return code %d.",
self.name, self.proc.pid, self.proc.returncode)
self.fuzzer_return_code = 0
GrosQuildu marked this conversation as resolved.
Show resolved Hide resolved
run_one_fuzzer_process = False

else:
if stdout:
L.error(stdout.decode('utf8'))
if stderr:
L.error(stderr.decode('utf8'))
self.fuzzer_return_code = self.proc.returncode
raise FuzzFrontendError(f"Fuzzer {self.name} (PID {self.proc.pid}) exited "
f"with return code {self.proc.returncode}.")

Expand Down