summaryrefslogtreecommitdiff
path: root/csmith-fuzzing/predicate.py
diff options
context:
space:
mode:
authorDaniel Brooks <db48x@db48x.net>2018-06-03 06:17:11 -0700
committerDaniel Brooks <db48x@db48x.net>2018-06-03 06:17:11 -0700
commitf703fe62e30ebd2f5898668bef41fe3af77c6695 (patch)
tree7f1f75dbd9e89dbfbad527fd5135f70b0bc138be /csmith-fuzzing/predicate.py
parentcaa020b80ac7b77d5c272470af611c53a5a62f3b (diff)
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.
Diffstat (limited to 'csmith-fuzzing/predicate.py')
-rwxr-xr-xcsmith-fuzzing/predicate.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/csmith-fuzzing/predicate.py b/csmith-fuzzing/predicate.py
index 3bf452ef..26025187 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="")
+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,