Test on all cores

This commit is contained in:
Emil Fresk 2022-03-19 16:27:26 +01:00
parent ca2577e3b8
commit 0e9375ced3
8 changed files with 170 additions and 28 deletions

View file

@ -173,13 +173,12 @@ jobs:
cd examples-runner
cargo xtask --target ${{ matrix.target }} --runner qemu
testexamplesembeddedci:
name: testexamplesembeddedci
testexamplesembeddedcim0:
name: testexamplesembeddedcim0
runs-on: ubuntu-20.04
strategy:
matrix:
target:
- thumbv7m-none-eabi
- thumbv6m-none-eabi
toolchain:
- stable
@ -211,7 +210,124 @@ jobs:
EMBEDDED_CI_SERVER: ${{ secrets.EMBEDDED_CI_SERVER }}
run: |
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
checkmacros:
@ -408,7 +524,10 @@ jobs:
- clippy
- checkexamples
- testexamplesqemu
- testexamplesembeddedci
- testexamplesembeddedcim0
- testexamplesembeddedcim3
- testexamplesembeddedcim4
- testexamplesembeddedcim7
- checkmacros
- testmacros
- tests
@ -591,7 +710,10 @@ jobs:
- clippy
- checkexamples
- testexamplesqemu
- testexamplesembeddedci
- testexamplesembeddedcim0
- testexamplesembeddedcim3
- testexamplesembeddedcim4
- testexamplesembeddedcim7
- checkmacros
- testmacros
- tests

View file

@ -25,8 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
let mono = Systick::new(systick, 1_000_000);
println!("init");

View file

@ -25,8 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mut mono = Systick::new(systick, 12_000_000);
let mut mono = Systick::new(systick, 1_000_000);
foo::spawn_after(1.secs(), mono.now()).unwrap();

View file

@ -25,8 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mut mono = Systick::new(systick, 12_000_000);
let mut mono = Systick::new(systick, 1_000_000);
foo::spawn_after(1.secs(), mono.now()).unwrap();

View file

@ -25,8 +25,8 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
// Initialize the monotonic
let mono = Systick::new(systick, 1_000_000);
foo::spawn_after(1.secs()).unwrap();

View file

@ -25,8 +25,7 @@ mod app {
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
let systick = cx.core.SYST;
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
let mono = Systick::new(systick, 12_000_000);
let mono = Systick::new(systick, 1_000_000);
println!("init");

View file

@ -17,6 +17,14 @@ pub enum Runner {
EmbeddedCi,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, ArgEnum)]
pub enum CoreRun {
CortexM0,
CortexM3,
CortexM4,
CortexM7,
}
#[derive(Debug)]
pub enum CargoCommand<'a> {
Run {
@ -25,6 +33,7 @@ pub enum CargoCommand<'a> {
features: Option<&'a str>,
mode: BuildMode,
runner: Runner,
core_runner: Option<CoreRun>,
},
BuildAll {
target: &'a str,
@ -54,6 +63,7 @@ impl<'a> CargoCommand<'a> {
features,
mode,
runner,
core_runner,
} => match runner {
Runner::Qemu => {
let mut args = vec![self.name(), "--bin", example, "--target", target];
@ -68,6 +78,14 @@ impl<'a> CargoCommand<'a> {
}
Runner::EmbeddedCi => {
let mut args = vec![];
match core_runner {
Some(CoreRun::CortexM0) => {
args.extend_from_slice(&["--cores", "cortexm0plus"])
}
Some(CoreRun::CortexM3) => args.extend_from_slice(&["--cores", "cortexm3"]),
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") {
@ -75,6 +93,8 @@ impl<'a> CargoCommand<'a> {
} else {
panic!("Unknown target: {}", target);
}
}
}
let s = Box::new(format!("target/{target}/{mode}/{example}"));
let s = s.into_boxed_str();
let s: &'static str = Box::leak(s);
@ -112,6 +132,7 @@ impl<'a> CargoCommand<'a> {
features: _,
mode: _,
runner,
core_runner: _,
} => match runner {
Runner::Qemu => "cargo",
Runner::EmbeddedCi => "embedded-ci-client",

View file

@ -2,7 +2,7 @@ mod build;
mod command;
use anyhow::bail;
use clap::Parser;
use clap::{ArgEnum, Parser};
use core::fmt;
use std::{
error::Error,
@ -15,7 +15,7 @@ use std::{
use crate::{
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";
@ -28,6 +28,8 @@ struct Options {
target: String,
#[clap(short, long, arg_enum)]
runner: Runner,
#[clap(short, long, arg_enum)]
core_runner: Option<CoreRun>
}
#[derive(Debug, Clone)]
@ -99,14 +101,14 @@ fn main() -> anyhow::Result<()> {
let opts = Options::parse();
let target = &opts.target;
init_build_dir()?;
// init_build_dir()?;
if target == "all" {
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()) {
run_tests(&target, opts.runner, &examples)?;
run_tests(&target, opts.runner, opts.core_runner, &examples)?;
} else {
eprintln!(
"The target you specified is not available. Available targets are:\
@ -120,7 +122,7 @@ fn main() -> anyhow::Result<()> {
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 {
Runner::Qemu => "qemu",
Runner::EmbeddedCi => "embedded-ci",
@ -139,6 +141,7 @@ fn run_tests(target: &str, runner: Runner, examples: &[String]) -> anyhow::Resul
features,
mode: BuildMode::Release,
runner,
core_runner,
};
arm_example(&cmd)?;