diff --git a/grizzly/args.py b/grizzly/args.py index a28badb9..79ea4b39 100644 --- a/grizzly/args.py +++ b/grizzly/args.py @@ -214,6 +214,7 @@ def __init__(self): ) self.reporter_grp.add_argument( "-l", + "-o", "--logs", default=Path.cwd(), type=Path, @@ -287,8 +288,7 @@ def sanity_check(self, args): self.parser.error("--log-limit must be >= 0") args.log_limit *= 1_048_576 - # if logs is specified, we need it to be a directory (whether existent or not) - if args.logs and args.logs.is_file(): + if args.logs.is_file(): self.parser.error("--logs cannot be a file") if args.memory < 0: diff --git a/grizzly/reduce/args.py b/grizzly/reduce/args.py index 7a54397a..22aeaa79 100644 --- a/grizzly/reduce/args.py +++ b/grizzly/reduce/args.py @@ -22,10 +22,6 @@ class ReduceCommonArgs(ReplayCommonArgs): def __init__(self): """Initialize argument parser.""" super().__init__() - - # these arguments have defaults that vary from ReplayCommonArgs - self.parser.set_defaults(logs=Path.cwd()) - reduce_args = self.parser.add_argument_group("Reduce Arguments") reduce_args.add_argument( "--no-analysis", diff --git a/grizzly/replay/args.py b/grizzly/replay/args.py index 585dcd8a..ec691797 100644 --- a/grizzly/replay/args.py +++ b/grizzly/replay/args.py @@ -14,7 +14,6 @@ class ReplayCommonArgs(CommonArgs): def __init__(self): super().__init__() - self.parser.set_defaults(logs=None) replay_args = self.parser.add_argument_group("Replay Arguments") replay_args.set_defaults(entry_point=None) @@ -66,9 +65,6 @@ def sanity_check(self, args): if args.idle_threshold and args.idle_delay <= 0: self.parser.error("--idle-delay value must be positive") - if args.logs is None and (args.pernosco or args.rr): - self.parser.error("--logs must be set when using rr") - if args.min_crashes < 1: self.parser.error("--min-crashes value must be positive") @@ -85,6 +81,11 @@ def __init__(self): super().__init__() self.parser.add_argument("input", type=Path, nargs="+", help=LOCAL_INPUT_HELP) + self.reporter_grp.add_argument( + "--disable-reporting", + action="store_true", + help="Do not report or save results.", + ) self.launcher_grp.add_argument( "--entry-point", type=Path, @@ -109,6 +110,12 @@ def __init__(self): super().__init__() self.parser.add_argument("input", type=int, help="Bugzilla BugID to replay") + self.reporter_grp.add_argument( + "--disable-reporting", + action="store_true", + help="Do not report or save results.", + ) + class ReplayFuzzManagerIDArgs(ReplayCommonArgs): def __init__(self): @@ -116,6 +123,11 @@ def __init__(self): super().__init__() self.parser.add_argument("input", type=int, help="FuzzManager ID to replay") + self.reporter_grp.add_argument( + "--disable-reporting", + action="store_true", + help="Do not report or save results.", + ) self.parser.add_argument( "--test-index", type=int, diff --git a/grizzly/replay/replay.py b/grizzly/replay/replay.py index 54190509..1112135b 100644 --- a/grizzly/replay/replay.py +++ b/grizzly/replay/replay.py @@ -694,7 +694,7 @@ def main(cls, args): LOG.info("Results detected, signature does not match") else: LOG.info("No results detected") - if results and (args.logs or args.fuzzmanager): + if results and not args.disable_reporting: # add target assets to test cases if not target.asset_mgr.is_empty(): for test in testcases: diff --git a/grizzly/replay/test_args.py b/grizzly/replay/test_args.py index b4fc669a..0633b498 100644 --- a/grizzly/replay/test_args.py +++ b/grizzly/replay/test_args.py @@ -4,9 +4,7 @@ """ unit tests for grizzly.replay.args """ -from platform import system - -from pytest import mark, param, raises +from pytest import mark, raises from .args import ReplayArgs, ReplayFuzzManagerIDArgs, ReplayFuzzManagerIDQualityArgs @@ -47,13 +45,6 @@ def test_replay_args_01(capsys, mocker, tmp_path): (["--min-crashes", "0"], "error: --min-crashes value must be positive", 1), # test invalid repeat value (["--repeat", "-1"], "error: --repeat value must be positive", 1), - # test running with rr without --logs set - param( - ["--rr"], - "error: --logs must be set when using rr", - 1, - marks=[mark.skipif(system() != "Linux", reason="Linux only")], - ), # test missing signature file (["--sig", "missing"], "error: signature file not found", 1), # test --no-harness with multiple inputs diff --git a/grizzly/replay/test_main.py b/grizzly/replay/test_main.py index 4d1d4547..b460f827 100644 --- a/grizzly/replay/test_main.py +++ b/grizzly/replay/test_main.py @@ -59,6 +59,7 @@ def test_main_01(mocker, server, tmp_path): args = mocker.Mock( any_crash=False, asset=[], + disable_reporting=False, entry_point=None, fuzzmanager=False, idle_delay=0, @@ -133,7 +134,6 @@ def test_main_02(mocker, server, tmp_path, repro_results): args = mocker.Mock( any_crash=False, asset=[], - fuzzmanager=False, idle_delay=0, idle_threshold=0, ignore=[], @@ -202,7 +202,6 @@ def test_main_03(mocker, load_plugin, load_testcases, signature, result): # setup args args = mocker.Mock( asset=[], - fuzzmanager=False, ignore=["timeout"] if signature else [], input=["test"], min_crashes=1, @@ -295,6 +294,7 @@ def test_main_05(mocker, server, tmp_path): # setup args args = mocker.Mock( asset=[["from_cmdline", str(asset)]], + disable_reporting=False, entry_point=None, fuzzmanager=False, idle_delay=0, @@ -370,7 +370,6 @@ def test_main_06( (tmp_path / "test.html").touch() args = mocker.Mock( asset=[], - fuzzmanager=False, idle_delay=0, idle_threshold=0, ignore=["fake", "timeout"], @@ -420,6 +419,7 @@ def test_main_07(mocker, server, tmp_path): args = mocker.Mock( any_crash=False, asset=[], + disable_reporting=False, entry_point=None, fuzzmanager=True, idle_delay=0, @@ -461,7 +461,6 @@ def test_main_08(mocker, tmp_path, https_supported): adapter="fake", binary=Path("bin"), input=[tmp_path / "test.html"], - fuzzmanager=False, launch_attempts=1, min_crashes=1, relaunch=1, @@ -502,12 +501,10 @@ def test_main_09(mocker, server, tmp_path): adapter="fake", binary=Path("bin"), entry_point=None, - fuzzmanager=False, idle_delay=0, idle_threshold=0, input=[input_path], launch_attempts=1, - logs=None, min_crashes=1, post_launch_delay=-1, relaunch=1,