diff options
author | 2023-07-08 00:35:15 +0000 | |
---|---|---|
committer | 2023-07-27 07:03:14 +0000 | |
commit | 78a1f8dfb8dbbe4c23189af04999c6263ab59ebb (patch) | |
tree | deed727483191f711053c359b9e6dc8905cb7837 /rust/bindgen_test.go | |
parent | 5ad5c918a39523260041baafc42b9972afe93c0f (diff) |
rust: Add Bindgen_flag_files property
Add a new Bindgen_flag_files property to bindgen modules
that let users specify files that contain extra flags for
bindgen.
Bug: 242243245
Test: presubmit
Change-Id: I21d987c08ac417c04aaa3bfb3b75d563fc662d5b
Diffstat (limited to 'rust/bindgen_test.go')
-rw-r--r-- | rust/bindgen_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go index af04cfc89..12cdb3cb4 100644 --- a/rust/bindgen_test.go +++ b/rust/bindgen_test.go @@ -168,3 +168,28 @@ func TestBindgenDisallowedFlags(t *testing.T) { } `) } + +func TestBindgenFlagFile(t *testing.T) { + ctx := testRust(t, ` + rust_bindgen { + name: "libbindgen", + wrapper_src: "src/any.h", + crate_name: "bindgen", + stem: "libbindgen", + source_stem: "bindings", + bindgen_flag_files: [ + "flag_file.txt", + ], + } + `) + libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs") + + if !strings.Contains(libbindgen.Args["flagfiles"], "/dev/null") { + t.Errorf("missing /dev/null in rust_bindgen rule: flags %#v", libbindgen.Args["flagfiles"]) + } + if !strings.Contains(libbindgen.Args["flagfiles"], "flag_file.txt") { + t.Errorf("missing bindgen flags file in rust_bindgen rule: flags %#v", libbindgen.Args["flagfiles"]) + } + // TODO: The best we can do right now is check $flagfiles. Once bindgen.go switches to RuleBuilder, + // we may be able to check libbinder.RuleParams.Command to see if it contains $(cat /dev/null flag_file.txt) +} |