diff --git a/csmith-fuzzing/predicate.py b/csmith-fuzzing/predicate.py index 3bf452ef19..4909b4f689 100755 --- a/csmith-fuzzing/predicate.py +++ b/csmith-fuzzing/predicate.py @@ -83,6 +83,10 @@ action="store_false", 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", @@ -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,