summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-11-28 13:54:55 -0600
committerGitHub <noreply@github.com>2017-11-28 13:54:55 -0600
commit0af9c897939c68eed3e5fb3ee07d99b5f53fd7a5 (patch)
treedf2adb188af1dc57f5bc446cf58313d4d75b56b1
parent75f9e1c233ab4c41a3e52afe7b349142d569dc0a (diff)
parent1c2172f7516ae90edfcfdc9a71849c8a37fc97fa (diff)
Auto merge of #1163 - fitzgen:remove-unnecessary-ci-jobs, r=emilio
Remove unnecessary ci jobs And then in the process I noticed that we weren't running the layout tests for any of the libclang version-specific expectation files, so I also fixed that. r? @emilio or @pepyakin
-rw-r--r--.travis.yml4
-rw-r--r--tests/expectations/build.rs60
-rw-r--r--tests/expectations/tests/libclang_version_specific_generated_tests.rs1
3 files changed, 61 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index e5d0e105..79e35e42 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,14 +21,10 @@ env:
- LLVM_VERSION="3.8.1" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- - LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- - LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions"
diff --git a/tests/expectations/build.rs b/tests/expectations/build.rs
new file mode 100644
index 00000000..0727ce51
--- /dev/null
+++ b/tests/expectations/build.rs
@@ -0,0 +1,60 @@
+//! Generate a module with a custom `#[path=...]` for each of the files in our
+//! libclang version-specific test expectations so that they get their layout
+//! tests run. We need to do this because cargo doesn't automatically detect
+//! tests subdirectories.
+
+use std::env;
+use std::fs;
+use std::io::Write;
+use std::path::Path;
+
+const LIBCLANG_VERSION_DIRS: &'static [&'static str] =
+ &["libclang-3.8", "libclang-3.9", "libclang-4"];
+
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+
+ let mut test_string = String::new();
+
+ for dir in LIBCLANG_VERSION_DIRS {
+ let dir = Path::new(&env::var_os("CARGO_MANIFEST_DIR").unwrap())
+ .join("tests")
+ .join(dir);
+
+ println!("cargo:rerun-if-changed={}", dir.display());
+
+ for entry in fs::read_dir(dir).unwrap() {
+ let entry = entry.unwrap();
+ let path = entry.path();
+ let path = path.canonicalize().unwrap_or_else(|_| path.into());
+ if path.extension().map(|e| e.to_string_lossy()) != Some("rs".into()) {
+ continue;
+ }
+
+ println!("cargo:rerun-if-changed={}", path.display());
+
+ let module_name: String = path.display()
+ .to_string()
+ .chars()
+ .map(|c| match c {
+ 'a'...'z' | 'A'...'Z' | '0'...'9' => c,
+ _ => '_',
+ })
+ .collect();
+
+ test_string.push_str(&format!(
+ r###"
+#[path = "{}"]
+mod {};
+"###,
+ path.display(),
+ module_name,
+ ));
+ }
+ }
+
+ let out_path = Path::new(&env::var_os("OUT_DIR").unwrap())
+ .join("libclang_version_specific_generated_tests.rs");
+ let mut test_file = fs::File::create(out_path).unwrap();
+ test_file.write_all(test_string.as_bytes()).unwrap();
+}
diff --git a/tests/expectations/tests/libclang_version_specific_generated_tests.rs b/tests/expectations/tests/libclang_version_specific_generated_tests.rs
new file mode 100644
index 00000000..93cf0d47
--- /dev/null
+++ b/tests/expectations/tests/libclang_version_specific_generated_tests.rs
@@ -0,0 +1 @@
+include!(concat!(env!("OUT_DIR"), "/libclang_version_specific_generated_tests.rs"));