aboutsummaryrefslogtreecommitdiff
path: root/xtask/tests/ci.rs
diff options
context:
space:
mode:
authorGravatar bors[bot] <26634292+bors[bot]@users.noreply.github.com> 2020-08-28 20:34:31 +0000
committerGravatar GitHub <noreply@github.com> 2020-08-28 20:34:31 +0000
commit54f541c87b0723ad8976f978b2233d56100702b6 (patch)
treeb284d3ef162113aeae169228a5b294a1c33f8234 /xtask/tests/ci.rs
parent36886f19b6ca0ac3b30ddf8543d330a445506057 (diff)
parent0a118397332c10080c48d76e7416ce854a0260ba (diff)
downloadcortex-m-54f541c87b0723ad8976f978b2233d56100702b6.tar.gz
cortex-m-54f541c87b0723ad8976f978b2233d56100702b6.tar.zst
cortex-m-54f541c87b0723ad8976f978b2233d56100702b6.zip
Merge #261
261: Replace shell scripts with integration test r=therealprof a=jonas-schievink * Removes the Clippy check from CI (I don't think we should fail CI when Clippy finds something, it seems better to use the GitHub Actions plugin) * Tests all targets (thumbv8m.base was missing) * Bumps MSRV to 1.35.0 (to get the thumbv8m.base libcore) Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Diffstat (limited to 'xtask/tests/ci.rs')
-rw-r--r--xtask/tests/ci.rs57
1 files changed, 57 insertions, 0 deletions
diff --git a/xtask/tests/ci.rs b/xtask/tests/ci.rs
new file mode 100644
index 0000000..48356e4
--- /dev/null
+++ b/xtask/tests/ci.rs
@@ -0,0 +1,57 @@
+use std::process::Command;
+use std::{env, str};
+use xtask::{check_blobs, install_targets};
+
+static TARGETS: &[&str] = &[
+ "thumbv6m-none-eabi",
+ "thumbv7m-none-eabi",
+ "thumbv7em-none-eabi",
+ "thumbv7em-none-eabihf",
+ "thumbv8m.base-none-eabi",
+ "thumbv8m.main-none-eabi",
+ "thumbv8m.main-none-eabihf",
+];
+
+fn build(target: &str, features: &[&str]) {
+ println!("building for {} {:?}", target, features);
+ let mut cargo = Command::new("cargo");
+ cargo.args(&["build", "--target", target]);
+ for feat in features {
+ cargo.args(&["--features", *feat]);
+ }
+
+ let status = cargo.status().unwrap();
+ assert!(status.success());
+}
+
+fn main() {
+ // Tests execute in the containing crate's root dir, `cd ..` so that we find `asm` etc.
+ env::set_current_dir("..").unwrap();
+
+ install_targets(&mut TARGETS.iter().cloned(), None);
+
+ // Check that the ASM blobs are up-to-date.
+ check_blobs();
+
+ let output = Command::new("rustc").arg("-V").output().unwrap();
+ let is_nightly = str::from_utf8(&output.stdout).unwrap().contains("nightly");
+
+ // Build `cortex-m` for each supported target.
+ for target in TARGETS {
+ build(*target, &[]);
+
+ if is_nightly {
+ // This may fail when nightly breaks. That's fine, the CI job isn't essential.
+ build(*target, &["inline-asm"]);
+ }
+
+ if target.starts_with("thumbv7em") {
+ // These can target Cortex-M7s, which have an errata workaround.
+ build(*target, &["cm7-r0p1"]);
+
+ if is_nightly {
+ build(*target, &["inline-asm", "cm7-r0p1"]);
+ }
+ }
+ }
+}