diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-06-03 11:16:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-03 11:16:46 -0400 |
commit | cfd0fa5e559327006d6fbc1e37357a2981aba224 (patch) | |
tree | 9c049016d0e03050c511a57346afec8525c62778 | |
parent | caa020b80ac7b77d5c272470af611c53a5a62f3b (diff) | |
parent | c9badcdb10026c0607989b310f1c61c662ab0a22 (diff) |
Auto merge of #1327 - db48x:fuzzing-extra-file, r=emilio
Add an option to extend the compiled code after each reducing step
This let me add a test function which called a method in the reduced
code, preventing creduce from eliminating everything entirely.
-rwxr-xr-x | csmith-fuzzing/predicate.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/csmith-fuzzing/predicate.py b/csmith-fuzzing/predicate.py index 3bf452ef..4909b4f6 100755 --- a/csmith-fuzzing/predicate.py +++ b/csmith-fuzzing/predicate.py @@ -84,6 +84,10 @@ reducing.add_argument( dest="rustc", help="Do not attempt to compile the emitted bindings with `rustc`.") reducing.add_argument( + "--extra-compile-file", + type=str, + help="Append the content of this extra file to the end of the emitted bindings just before compiling it.") +reducing.add_argument( "--expect-compile-fail", action="store_true", help="Exit non-zero if `rustc` successfully compiles the emitted bindings.") @@ -221,6 +225,10 @@ def run_bindgen(args, bindings): raise ExitOne() def run_rustc(args, bindings, test_exe): + if args.extra_compile_file: + with open(bindings, mode="a") as outfile: + with open(args.extra_compile_file, mode="r") as infile: + outfile.write(infile.read()) child = run( ["rustc", "--crate-type", "lib", "--test", "-o", test_exe, bindings], stdout=subprocess.PIPE, |