mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 20:22:51 +01:00
Test on all cores
This commit is contained in:
parent
ca2577e3b8
commit
0e9375ced3
8 changed files with 170 additions and 28 deletions
134
.github/workflows/build.yml
vendored
134
.github/workflows/build.yml
vendored
|
@ -173,13 +173,12 @@ jobs:
|
||||||
cd examples-runner
|
cd examples-runner
|
||||||
cargo xtask --target ${{ matrix.target }} --runner qemu
|
cargo xtask --target ${{ matrix.target }} --runner qemu
|
||||||
|
|
||||||
testexamplesembeddedci:
|
testexamplesembeddedcim0:
|
||||||
name: testexamplesembeddedci
|
name: testexamplesembeddedcim0
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
- thumbv7m-none-eabi
|
|
||||||
- thumbv6m-none-eabi
|
- thumbv6m-none-eabi
|
||||||
toolchain:
|
toolchain:
|
||||||
- stable
|
- stable
|
||||||
|
@ -211,7 +210,124 @@ jobs:
|
||||||
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
|
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
|
||||||
run: |
|
run: |
|
||||||
cd examples-runner
|
cd examples-runner
|
||||||
cargo xtask --target ${{ matrix.target }} --runner embedded-ci
|
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m0
|
||||||
|
|
||||||
|
testexamplesembeddedcim3:
|
||||||
|
name: testexamplesembeddedcim3
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- thumbv7m-none-eabi
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
override: true
|
||||||
|
components: llvm-tools-preview
|
||||||
|
|
||||||
|
- name: Cache Dependencies
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
|
- name: Install embedded-ci-client
|
||||||
|
run: |
|
||||||
|
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client
|
||||||
|
|
||||||
|
- name: Fail on warnings
|
||||||
|
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
|
||||||
|
|
||||||
|
- name: Run-pass tests
|
||||||
|
env:
|
||||||
|
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
|
||||||
|
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
|
||||||
|
run: |
|
||||||
|
cd examples-runner
|
||||||
|
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m3
|
||||||
|
|
||||||
|
testexamplesembeddedcim4:
|
||||||
|
name: testexamplesembeddedcim4
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- thumbv7m-none-eabi
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
override: true
|
||||||
|
components: llvm-tools-preview
|
||||||
|
|
||||||
|
- name: Cache Dependencies
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
|
- name: Install embedded-ci-client
|
||||||
|
run: |
|
||||||
|
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client
|
||||||
|
|
||||||
|
- name: Fail on warnings
|
||||||
|
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
|
||||||
|
|
||||||
|
- name: Run-pass tests
|
||||||
|
env:
|
||||||
|
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
|
||||||
|
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
|
||||||
|
run: |
|
||||||
|
cd examples-runner
|
||||||
|
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m4
|
||||||
|
|
||||||
|
testexamplesembeddedcim7:
|
||||||
|
name: testexamplesembeddedcim7
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- thumbv7m-none-eabi
|
||||||
|
toolchain:
|
||||||
|
- stable
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: ${{ matrix.toolchain }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
override: true
|
||||||
|
components: llvm-tools-preview
|
||||||
|
|
||||||
|
- name: Cache Dependencies
|
||||||
|
uses: Swatinem/rust-cache@v1
|
||||||
|
|
||||||
|
- name: Install embedded-ci-client
|
||||||
|
run: |
|
||||||
|
cargo install --git https://github.com/korken89/embedded-ci.git embedded-ci-client
|
||||||
|
|
||||||
|
- name: Fail on warnings
|
||||||
|
run: sed -i 's,//deny_warnings_placeholder_for_ci,#![deny(warnings)],' src/lib.rs macros/src/lib.rs
|
||||||
|
|
||||||
|
- name: Run-pass tests
|
||||||
|
env:
|
||||||
|
EMBEDDED_CI_TOKEN: ${{ secrets.EMBEDDED_CI_TOKEN }}
|
||||||
|
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
|
||||||
|
run: |
|
||||||
|
cd examples-runner
|
||||||
|
cargo xtask --target ${{ matrix.target }} --runner embedded-ci --core-runner cortex-m7
|
||||||
|
|
||||||
# Check the correctness of macros/ crate
|
# Check the correctness of macros/ crate
|
||||||
checkmacros:
|
checkmacros:
|
||||||
|
@ -408,7 +524,10 @@ jobs:
|
||||||
- clippy
|
- clippy
|
||||||
- checkexamples
|
- checkexamples
|
||||||
- testexamplesqemu
|
- testexamplesqemu
|
||||||
- testexamplesembeddedci
|
- testexamplesembeddedcim0
|
||||||
|
- testexamplesembeddedcim3
|
||||||
|
- testexamplesembeddedcim4
|
||||||
|
- testexamplesembeddedcim7
|
||||||
- checkmacros
|
- checkmacros
|
||||||
- testmacros
|
- testmacros
|
||||||
- tests
|
- tests
|
||||||
|
@ -591,7 +710,10 @@ jobs:
|
||||||
- clippy
|
- clippy
|
||||||
- checkexamples
|
- checkexamples
|
||||||
- testexamplesqemu
|
- testexamplesqemu
|
||||||
- testexamplesembeddedci
|
- testexamplesembeddedcim0
|
||||||
|
- testexamplesembeddedcim3
|
||||||
|
- testexamplesembeddedcim4
|
||||||
|
- testexamplesembeddedcim7
|
||||||
- checkmacros
|
- checkmacros
|
||||||
- testmacros
|
- testmacros
|
||||||
- tests
|
- tests
|
||||||
|
|
|
@ -25,8 +25,7 @@ mod app {
|
||||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||||
let systick = cx.core.SYST;
|
let systick = cx.core.SYST;
|
||||||
|
|
||||||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
let mono = Systick::new(systick, 1_000_000);
|
||||||
let mono = Systick::new(systick, 12_000_000);
|
|
||||||
|
|
||||||
println!("init");
|
println!("init");
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ mod app {
|
||||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||||
let systick = cx.core.SYST;
|
let systick = cx.core.SYST;
|
||||||
|
|
||||||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
let mut mono = Systick::new(systick, 1_000_000);
|
||||||
let mut mono = Systick::new(systick, 12_000_000);
|
|
||||||
|
|
||||||
foo::spawn_after(1.secs(), mono.now()).unwrap();
|
foo::spawn_after(1.secs(), mono.now()).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ mod app {
|
||||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||||
let systick = cx.core.SYST;
|
let systick = cx.core.SYST;
|
||||||
|
|
||||||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
let mut mono = Systick::new(systick, 1_000_000);
|
||||||
let mut mono = Systick::new(systick, 12_000_000);
|
|
||||||
|
|
||||||
foo::spawn_after(1.secs(), mono.now()).unwrap();
|
foo::spawn_after(1.secs(), mono.now()).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ mod app {
|
||||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||||
let systick = cx.core.SYST;
|
let systick = cx.core.SYST;
|
||||||
|
|
||||||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
// Initialize the monotonic
|
||||||
let mono = Systick::new(systick, 12_000_000);
|
let mono = Systick::new(systick, 1_000_000);
|
||||||
|
|
||||||
foo::spawn_after(1.secs()).unwrap();
|
foo::spawn_after(1.secs()).unwrap();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ mod app {
|
||||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||||
let systick = cx.core.SYST;
|
let systick = cx.core.SYST;
|
||||||
|
|
||||||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
let mono = Systick::new(systick, 1_000_000);
|
||||||
let mono = Systick::new(systick, 12_000_000);
|
|
||||||
|
|
||||||
println!("init");
|
println!("init");
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,14 @@ pub enum Runner {
|
||||||
EmbeddedCi,
|
EmbeddedCi,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, ArgEnum)]
|
||||||
|
pub enum CoreRun {
|
||||||
|
CortexM0,
|
||||||
|
CortexM3,
|
||||||
|
CortexM4,
|
||||||
|
CortexM7,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CargoCommand<'a> {
|
pub enum CargoCommand<'a> {
|
||||||
Run {
|
Run {
|
||||||
|
@ -25,6 +33,7 @@ pub enum CargoCommand<'a> {
|
||||||
features: Option<&'a str>,
|
features: Option<&'a str>,
|
||||||
mode: BuildMode,
|
mode: BuildMode,
|
||||||
runner: Runner,
|
runner: Runner,
|
||||||
|
core_runner: Option<CoreRun>,
|
||||||
},
|
},
|
||||||
BuildAll {
|
BuildAll {
|
||||||
target: &'a str,
|
target: &'a str,
|
||||||
|
@ -54,6 +63,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
features,
|
features,
|
||||||
mode,
|
mode,
|
||||||
runner,
|
runner,
|
||||||
|
core_runner,
|
||||||
} => match runner {
|
} => match runner {
|
||||||
Runner::Qemu => {
|
Runner::Qemu => {
|
||||||
let mut args = vec![self.name(), "--bin", example, "--target", target];
|
let mut args = vec![self.name(), "--bin", example, "--target", target];
|
||||||
|
@ -68,12 +78,22 @@ impl<'a> CargoCommand<'a> {
|
||||||
}
|
}
|
||||||
Runner::EmbeddedCi => {
|
Runner::EmbeddedCi => {
|
||||||
let mut args = vec![];
|
let mut args = vec![];
|
||||||
if target.contains("thumbv6") {
|
match core_runner {
|
||||||
args.extend_from_slice(&["--cores", "cortexm0plus"])
|
Some(CoreRun::CortexM0) => {
|
||||||
} else if target.contains("thumbv7") {
|
args.extend_from_slice(&["--cores", "cortexm0plus"])
|
||||||
args.extend_from_slice(&["--cores", "cortexm3,cortexm4,cortexm7"])
|
}
|
||||||
} else {
|
Some(CoreRun::CortexM3) => args.extend_from_slice(&["--cores", "cortexm3"]),
|
||||||
panic!("Unknown target: {}", target);
|
Some(CoreRun::CortexM4) => args.extend_from_slice(&["--cores", "cortexm4"]),
|
||||||
|
Some(CoreRun::CortexM7) => args.extend_from_slice(&["--cores", "cortexm7"]),
|
||||||
|
None => {
|
||||||
|
if target.contains("thumbv6") {
|
||||||
|
args.extend_from_slice(&["--cores", "cortexm0plus"])
|
||||||
|
} else if target.contains("thumbv7") {
|
||||||
|
args.extend_from_slice(&["--cores", "cortexm3,cortexm4,cortexm7"])
|
||||||
|
} else {
|
||||||
|
panic!("Unknown target: {}", target);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let s = Box::new(format!("target/{target}/{mode}/{example}"));
|
let s = Box::new(format!("target/{target}/{mode}/{example}"));
|
||||||
let s = s.into_boxed_str();
|
let s = s.into_boxed_str();
|
||||||
|
@ -112,6 +132,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
features: _,
|
features: _,
|
||||||
mode: _,
|
mode: _,
|
||||||
runner,
|
runner,
|
||||||
|
core_runner: _,
|
||||||
} => match runner {
|
} => match runner {
|
||||||
Runner::Qemu => "cargo",
|
Runner::Qemu => "cargo",
|
||||||
Runner::EmbeddedCi => "embedded-ci-client",
|
Runner::EmbeddedCi => "embedded-ci-client",
|
||||||
|
|
|
@ -2,7 +2,7 @@ mod build;
|
||||||
mod command;
|
mod command;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
use clap::Parser;
|
use clap::{ArgEnum, Parser};
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use std::{
|
use std::{
|
||||||
error::Error,
|
error::Error,
|
||||||
|
@ -15,7 +15,7 @@ use std::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
build::init_build_dir,
|
build::init_build_dir,
|
||||||
command::{run_command, run_successful, BuildMode, CargoCommand, Runner},
|
command::{run_command, run_successful, BuildMode, CargoCommand, Runner, CoreRun},
|
||||||
};
|
};
|
||||||
|
|
||||||
const ARMV6M: &str = "thumbv6m-none-eabi";
|
const ARMV6M: &str = "thumbv6m-none-eabi";
|
||||||
|
@ -28,6 +28,8 @@ struct Options {
|
||||||
target: String,
|
target: String,
|
||||||
#[clap(short, long, arg_enum)]
|
#[clap(short, long, arg_enum)]
|
||||||
runner: Runner,
|
runner: Runner,
|
||||||
|
#[clap(short, long, arg_enum)]
|
||||||
|
core_runner: Option<CoreRun>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -99,14 +101,14 @@ fn main() -> anyhow::Result<()> {
|
||||||
let opts = Options::parse();
|
let opts = Options::parse();
|
||||||
let target = &opts.target;
|
let target = &opts.target;
|
||||||
|
|
||||||
init_build_dir()?;
|
// init_build_dir()?;
|
||||||
|
|
||||||
if target == "all" {
|
if target == "all" {
|
||||||
for t in targets {
|
for t in targets {
|
||||||
run_tests(t, opts.runner, &examples)?;
|
run_tests(t, opts.runner, opts.core_runner, &examples)?;
|
||||||
}
|
}
|
||||||
} else if targets.contains(&target.as_str()) {
|
} else if targets.contains(&target.as_str()) {
|
||||||
run_tests(&target, opts.runner, &examples)?;
|
run_tests(&target, opts.runner, opts.core_runner, &examples)?;
|
||||||
} else {
|
} else {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"The target you specified is not available. Available targets are:\
|
"The target you specified is not available. Available targets are:\
|
||||||
|
@ -120,7 +122,7 @@ fn main() -> anyhow::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_tests(target: &str, runner: Runner, examples: &[String]) -> anyhow::Result<()> {
|
fn run_tests(target: &str, runner: Runner, core_runner: Option<CoreRun>, examples: &[String]) -> anyhow::Result<()> {
|
||||||
let features = Some(match runner {
|
let features = Some(match runner {
|
||||||
Runner::Qemu => "qemu",
|
Runner::Qemu => "qemu",
|
||||||
Runner::EmbeddedCi => "embedded-ci",
|
Runner::EmbeddedCi => "embedded-ci",
|
||||||
|
@ -139,6 +141,7 @@ fn run_tests(target: &str, runner: Runner, examples: &[String]) -> anyhow::Resul
|
||||||
features,
|
features,
|
||||||
mode: BuildMode::Release,
|
mode: BuildMode::Release,
|
||||||
runner,
|
runner,
|
||||||
|
core_runner,
|
||||||
};
|
};
|
||||||
|
|
||||||
arm_example(&cmd)?;
|
arm_example(&cmd)?;
|
||||||
|
|
Loading…
Reference in a new issue