Merge "[rust] Escape flags for bindgen"

This commit is contained in:
Matthew Maurer
2020-08-06 21:33:49 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 6 deletions

View File

@@ -27,8 +27,8 @@ func TestRustBindgen(t *testing.T) {
crate_name: "bindgen",
stem: "libbindgen",
source_stem: "bindings",
bindgen_flags: ["--bindgen-flag"],
cflags: ["--clang-flag"],
bindgen_flags: ["--bindgen-flag.*"],
cflags: ["--clang-flag()"],
shared_libs: ["libfoo_shared"],
static_libs: ["libfoo_static"],
}
@@ -42,10 +42,11 @@ func TestRustBindgen(t *testing.T) {
}
`)
libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a").Output("bindings.rs")
if !strings.Contains(libbindgen.Args["flags"], "--bindgen-flag") {
// Ensure that the flags are present and escaped
if !strings.Contains(libbindgen.Args["flags"], "'--bindgen-flag.*'") {
t.Errorf("missing bindgen flags in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
}
if !strings.Contains(libbindgen.Args["cflags"], "--clang-flag") {
if !strings.Contains(libbindgen.Args["cflags"], "'--clang-flag()'") {
t.Errorf("missing clang cflags in rust_bindgen rule: cflags %#v", libbindgen.Args["cflags"])
}
if !strings.Contains(libbindgen.Args["cflags"], "-Ishared_include") {