summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tests.rs b/tests/tests.rs
index 69500268..05a39fad 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -137,6 +137,20 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
}
}
+ // Windows platform has various different conventions than *nix platforms,
+ // e.g. default enum underlying type, struct padding, mangling. Most tests
+ // were written and checked on Linux and macOS, and thus they could fail on
+ // Windows. We just make those tests targetting Linux instead as far as one
+ // isn't annotated for a specific target.
+ if cfg!(target_os = "windows") {
+ if flags.iter().all(|flag| !flag.starts_with("--target=")) {
+ if !flags.iter().any(|flag| flag == "--") {
+ flags.push("--".into());
+ }
+ flags.push("--target=x86_64-unknown-linux".into());
+ }
+ }
+
// Fool builder_from_flags() into believing it has real env::args_os...
// - add "bindgen" as executable name 0th element
// - add header filename as 1st element