Skip to content

Commit f703fe6

Browse files
committed
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.
1 parent caa020b commit f703fe6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

csmith-fuzzing/predicate.py

+8
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
action="store_false",
8484
dest="rustc",
8585
help="Do not attempt to compile the emitted bindings with `rustc`.")
86+
reducing.add_argument(
87+
"--extra-compile-file",
88+
type=str,
89+
help="")
8690
reducing.add_argument(
8791
"--expect-compile-fail",
8892
action="store_true",
@@ -221,6 +225,10 @@ def run_bindgen(args, bindings):
221225
raise ExitOne()
222226

223227
def run_rustc(args, bindings, test_exe):
228+
if args.extra_compile_file:
229+
with open(bindings, mode="a") as outfile:
230+
with open(args.extra_compile_file, mode="r") as infile:
231+
outfile.write(infile.read())
224232
child = run(
225233
["rustc", "--crate-type", "lib", "--test", "-o", test_exe, bindings],
226234
stdout=subprocess.PIPE,

0 commit comments

Comments
 (0)