summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-05-25 10:50:36 -0500
committerGitHub <noreply@github.com>2017-05-25 10:50:36 -0500
commite30f219a1ad393370d4c2fc3a65c62a49633e29c (patch)
tree5f5d83e8b266eceabf0788b31e28566f1ebe368f
parent50faeab09f240588e519995e85a2eabbfc691252 (diff)
parent05c7fd59c6cf114e12a5617fdfbea5e4d0cdecb4 (diff)
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
-rw-r--r--tests/headers/call-conv-field.h6
-rw-r--r--tests/tests.rs9
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/headers/call-conv-field.h b/tests/headers/call-conv-field.h
index 310b5c32..3488cd5b 100644
--- a/tests/headers/call-conv-field.h
+++ b/tests/headers/call-conv-field.h
@@ -1,5 +1,11 @@
// bindgen-flags: -- -target i686-pc-win32
// bindgen-unstable
+// bindgen-generate-bindings-on-linux-only
+//
+// The linux-only thing is a hack around our lack of understanding when
+// bindgen's target_os != the bindings' target_os :(
+//
+// https://github.com/servo/rust-bindgen/issues/593
struct JNINativeInterface_ {
int (__stdcall *GetVersion)(void *env);
diff --git a/tests/tests.rs b/tests/tests.rs
index c7e03cb5..9265b021 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -75,8 +75,12 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
// Scoop up bindgen-flags from test header
let mut flags = Vec::with_capacity(2);
- for line in reader.lines().take(3) {
+ for line in reader.lines() {
let line = try!(line);
+ if !line.starts_with("// bindgen") {
+ continue;
+ }
+
if line.contains("bindgen-flags: ") {
let extra_flags = line.split("bindgen-flags: ")
.last()
@@ -92,6 +96,9 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
.map(ToString::to_string)
.chain(flags)
.collect();
+ } else if line.contains("bindgen-generate-bindings-on-linux-only") &&
+ !cfg!(target_os = "linux") {
+ return Ok(None);
}
}