From 892e2ec117f817d5a439dfb39104b2be4678cd0b Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Sun, 3 Feb 2019 14:33:16 +0100 Subject: fuzzing: Add a --release flag to the predicate script. When you're not testing for debug assertions this is much faster. --- Cargo.lock | 2 ++ csmith-fuzzing/predicate.py | 18 +++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 838994ee..8b8107c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "aho-corasick" version = "0.6.8" diff --git a/csmith-fuzzing/predicate.py b/csmith-fuzzing/predicate.py index 4909b4f6..043a9935 100755 --- a/csmith-fuzzing/predicate.py +++ b/csmith-fuzzing/predicate.py @@ -65,6 +65,10 @@ equivalent-but-smaller test cases that exhibit the same bug with `creduce`. reducing = parser.add_argument_group("reducing arguments", REDUCING_DESC.strip()) +reducing.add_argument( + "--release", + action="store_true", + help="Use a release instead of a debug build.") reducing.add_argument( "--expect-bindgen-fail", action="store_true", @@ -194,13 +198,13 @@ def run_bindgen(args, bindings): manifest_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", "Cargo.toml")) - child = run( - ["cargo", "run", - "--manifest-path", manifest_path, - "--", - args.input, "-o", bindings] + shlex.split(args.bindgen_args), - stderr=subprocess.PIPE, - stdout=subprocess.PIPE) + command = ["cargo", "run", "--manifest-path", manifest_path] + if args.release: + command += ["--release"] + command += ["--", args.input, "-o", bindings] + command += shlex.split(args.bindgen_args) + + child = run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) if args.bindgen_grep: pattern = regexp(args.bindgen_grep) -- cgit v1.2.3