Lines Matching +full:format +full:- +full:extra +full:- +full:args
19 and non-zero if any of them fail. This is appropriate for determining if some
24 known-bad test case into a new, smaller test case that exhibits the same bad
26 compile with `rustc`, and want to exit non-zero early if that is not the
35 BINDGEN_ARGS = "--with-derive-partialeq \
36 --with-derive-eq \
37 --with-derive-partialord \
38 --with-derive-ord \
39 --with-derive-hash \
40 --with-derive-default"
43 "--bindgen-args",
49 "--save-temp-files",
61 Arguments that are useful when reducing known-bad test cases into
62 equivalent-but-smaller test cases that exhibit the same bug with `creduce`.
69 "--release",
73 "--expect-bindgen-fail",
75 help="Exit non-zero if `bindgen` successfully emits bindings.")
77 "--bindgen-grep",
79 help="Exit non-zero if the given regexp pattern is not found in `bindgen`'s output.")
81 "--bindings-grep",
84 help="Exit non-zero if the given regexp pattern is not found in the emitted bindings.")
87 "--no-compile-bindings",
92 "--extra-compile-file",
94 …help="Append the content of this extra file to the end of the emitted bindings just before compili…
96 "--expect-compile-fail",
98 help="Exit non-zero if `rustc` successfully compiles the emitted bindings.")
100 "--rustc-grep",
102 …help="Exit non-zero if the output from compiling the bindings with `rustc` does not contain the gi…
105 "--no-layout-tests",
110 "--expect-layout-tests-fail",
112 help="Exit non-zero if the compiled bindings' layout tests pass.")
114 "--layout-tests-grep",
116 …help="Exit non-zero if the output of running the compiled bindings' layout tests does not contain …
141 args = parser.parse_args()
146 bindings = new_temp_file(prefix="bindings-", suffix=".rs")
147 run_bindgen(args, bindings)
149 if args.rustc and not args.expect_bindgen_fail:
150 test_exe = new_temp_file(prefix="layout-tests-")
151 run_rustc(args, bindings, test_exe)
153 if args.layout_tests and not args.expect_compile_fail:
154 run_layout_tests(args, test_exe)
161 if not args.save_temp_files:
175 return f.decode(encoding="utf-8", errors="ignore")
198 def run_bindgen(args, bindings): argument
202 command = ["cargo", "run", "--manifest-path", manifest_path]
203 if args.release:
204 command += ["--release"]
205 command += ["--", args.input, "-o", bindings]
206 command += shlex.split(args.bindgen_args)
210 if args.bindgen_grep:
211 pattern = regexp(args.bindgen_grep)
214 … exit_1("Error: did not find '{}' in `bindgen`'s output".format(args.bindgen_grep), child)
216 if args.expect_bindgen_fail and child.returncode == 0:
219 if not args.expect_bindgen_fail and child.returncode != 0:
222 for arg in args.bindings_grep or []:
226 … print("Error: expected the emitted bindings to contain '{}', but they didn't".format(arg))
227 … print("---------- {} ----------------------------------------------".format(bindings))
232 def run_rustc(args, bindings, test_exe): argument
233 if args.extra_compile_file:
235 with open(args.extra_compile_file, mode="r") as infile:
238 ["rustc", "--crate-type", "lib", "--test", "-o", test_exe, bindings],
242 if args.rustc_grep:
243 pattern = regexp(args.rustc_grep)
246 exit_1("Error: did not find '{}' in `rustc`'s output".format(args.rustc_grep), child)
248 if args.expect_compile_fail and child.returncode == 0:
251 if not args.expect_compile_fail and child.returncode != 0:
254 def run_layout_tests(args, test_exe): argument
260 if args.layout_tests_grep:
261 pattern = regexp(args.layout_tests_grep)
264 …ror: did not find '{}' in the compiled bindings' layout tests' output".format(args.layout_tests_gr…
266 if args.expect_layout_tests_fail and child.returncode == 0:
269 if not args.expect_layout_tests_fail and child.returncode != 0: