Skip to content

Commit

Permalink
fuzz: test_runner: Better error message when built with afl
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Feb 14, 2019
1 parent fa7ca8e commit fa535af
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/fuzz/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,22 @@ def main():
logging.error("No fuzz targets selected")
logging.info("Fuzz targets selected: {}".format(test_list_selection))

help_output = subprocess.run(
args=[
os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', test_list_selection[0]),
'-help=1',
],
check=True,
stderr=subprocess.PIPE,
universal_newlines=True,
).stderr
if "libFuzzer" not in help_output:
logging.error("Must be built with libFuzzer")
try:
help_output = subprocess.run(
args=[
os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', test_list_selection[0]),
'-help=1',
],
timeout=1,
check=True,
stderr=subprocess.PIPE,
universal_newlines=True,
).stderr
if "libFuzzer" not in help_output:
logging.error("Must be built with libFuzzer")
sys.exit(1)
except subprocess.TimeoutExpired:
logging.error("subprocess timed out: Currently only libFuzzer is supported")
sys.exit(1)

run_once(
Expand Down

0 comments on commit fa535af

Please sign in to comment.