Skip to content

Commit e30f219

Browse files
author
bors-servo
authored
Auto merge of #719 - fitzgen:testing-stuff, r=emilio
Only run call-conv-field.h test on linux This is a temporary work around for issue #593 and this test failing on MacOS because we don't currently handle when the bindgen executable's target OS is not the same as the emitted bindings' target OS. r? @emilio
2 parents 50faeab + 05c7fd5 commit e30f219

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/headers/call-conv-field.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// bindgen-flags: -- -target i686-pc-win32
22
// bindgen-unstable
3+
// bindgen-generate-bindings-on-linux-only
4+
//
5+
// The linux-only thing is a hack around our lack of understanding when
6+
// bindgen's target_os != the bindings' target_os :(
7+
//
8+
// https://github.com/servo/rust-bindgen/issues/593
39

410
struct JNINativeInterface_ {
511
int (__stdcall *GetVersion)(void *env);

tests/tests.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
7575
// Scoop up bindgen-flags from test header
7676
let mut flags = Vec::with_capacity(2);
7777

78-
for line in reader.lines().take(3) {
78+
for line in reader.lines() {
7979
let line = try!(line);
80+
if !line.starts_with("// bindgen") {
81+
continue;
82+
}
83+
8084
if line.contains("bindgen-flags: ") {
8185
let extra_flags = line.split("bindgen-flags: ")
8286
.last()
@@ -92,6 +96,9 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
9296
.map(ToString::to_string)
9397
.chain(flags)
9498
.collect();
99+
} else if line.contains("bindgen-generate-bindings-on-linux-only") &&
100+
!cfg!(target_os = "linux") {
101+
return Ok(None);
95102
}
96103
}
97104

0 commit comments

Comments
 (0)