Skip to content

Make the default target for expectation files as x86_64-unknown-linux #1073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/headers/call-conv-field.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// bindgen-flags: -- -target i686-pc-win32
// bindgen-flags: -- --target=i686-pc-win32
// bindgen-unstable
// bindgen-generate-bindings-on-linux-only
//
Expand Down
19 changes: 8 additions & 11 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,13 @@ 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());
// Different platforms have various different conventions like struct padding, mangling, etc.
// We make the default target as x86_64-unknown-linux
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...
Expand Down Expand Up @@ -307,6 +302,7 @@ include!(concat!(env!("OUT_DIR"), "/tests.rs"));
fn test_header_contents() {
let actual = builder()
.header_contents("test.h", "int foo(const char* a);")
.clang_arg("--target=x86_64-unknown-linux")
.generate()
.unwrap()
.to_string();
Expand Down Expand Up @@ -335,6 +331,7 @@ fn test_multiple_header_calls_in_builder() {
"/tests/headers/func_ptr.h"
))
.header(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/char.h"))
.clang_arg("--target=x86_64-unknown-linux")
.generate()
.unwrap()
.to_string();
Expand Down