Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HW Runner integration testing CI gate #234

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/hwtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow executes HW tests on an NXP RT600 EVK.
# NOTE: for now it simply executes a build on the self-hosted test runner PC.
#
permissions:
contents: read
on:
push:
branches: [main]
pull_request:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
name: hwtest-automation
jobs:
hwtest-automation:
runs-on: self-hosted
name: Run integration tests
strategy:
matrix:
target: [thumbv8m.main-none-eabihf]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: run tests
run: |
cd examples\rt685s-evk
$sshcommand = "ssh [email protected] ./run_tests.sh " + "${{env.BRANCH_NAME}}"
Write-Output $sshcommand

Restore-VMCheckpoint -VMName "hwrunner" -Name "fresh" -Confirm:$false

# Pause for 5 seconds
Start-Sleep -Seconds 5

$output = Invoke-Expression $sshcommand

# Output the result
Write-Output $output

Restore-VMCheckpoint -VMName "hwrunner" -Name "fresh" -Confirm:$false

# Determine the success or failure based on the output
if ($output -match "Some tests failed:") {
exit 1
}
elseif ($output -match "All tests passed!") {
exit 0
}

exit 1
4 changes: 4 additions & 0 deletions examples/rt685s-evk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ futures = { version = "0.3.30", default-features = false, features = [
] }
mimxrt600-fcb = "0.1.0"
rand = { version = "0.8.5", default-features = false }
test-parser-macros = { git = "https://github.com/tullom/test-parser", optional = true }

[profile.release]
lto = true # better optimizations

[features]
test-parser = ["dep:test-parser-macros"]
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ async fn main(_spawner: Spawner) {

info!("ADC sample = {:#x}", data);

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

Timer::after_millis(1000).await;
}
}
6 changes: 5 additions & 1 deletion examples/rt685s-evk/src/bin/clocks-blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use embassy_executor::Spawner;
use embassy_imxrt::iopctl::IopctlPin;
use embassy_imxrt::{clocks, gpio};
use embassy_time::Timer;
use {defmt_rtt as _, embassy_imxrt as _, panic_probe as _};
use {defmt_rtt as _, embassy_imxrt as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
Expand Down Expand Up @@ -66,6 +66,10 @@ async fn main(_spawner: Spawner) {
loop {
info!("Toggling LED");
led.toggle();

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

Timer::after_millis(1000).await;
}
}
4 changes: 3 additions & 1 deletion examples/rt685s-evk/src/bin/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ extern crate embassy_imxrt_examples;
use defmt::*;
use embassy_executor::Spawner;
use embassy_imxrt::crc::{Config, Crc, Polynomial};
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
Expand All @@ -21,5 +20,8 @@ async fn main(_spawner: Spawner) {

defmt::assert_eq!(output, 0xebfebe9a);

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

cortex_m::asm::bkpt();
}
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/dma-mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#![no_main]

use defmt::*;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::dma::channel::Channel;
use embassy_imxrt::dma::transfer::{Priority, Transfer, TransferOptions, Width};
use embassy_imxrt::dma::Dma;
use embassy_imxrt::peripherals::*;
use {defmt_rtt as _, panic_probe as _};

const TEST_LEN: usize = 16;

Expand Down Expand Up @@ -87,4 +87,7 @@ async fn main(_spawner: Spawner) {
test_dma_channel!(p, DMA0_CH31, 31);

info!("DMA transfer tests completed");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();
}
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/gpio-async-input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
extern crate embassy_imxrt_examples;

use defmt::*;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::gpio;
use embassy_time::{Duration, Ticker};
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::task]
async fn monitor_task(mut monitor: gpio::Input<'static>) {
Expand Down Expand Up @@ -50,6 +50,9 @@ async fn main(spawner: Spawner) {

let mut ticker = Ticker::every(Duration::from_millis(100));

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

spawner.spawn(monitor_task(monitor)).unwrap();

loop {
Expand Down
4 changes: 4 additions & 0 deletions examples/rt685s-evk/src/bin/gpio-blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ async fn main(_spawner: Spawner) {
loop {
info!("Toggling LED");
led.toggle();

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

Timer::after_millis(1000).await;
}
}
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/gpio-flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ async fn main(_spawner: Spawner) {
// check pin level is high
assert!(flex.is_high());

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

loop {
Timer::after_millis(1000).await;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/gpio-input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ async fn main(_spawner: Spawner) {

let monitor = gpio::Input::new(p.PIO1_0, gpio::Pull::None, gpio::Inverter::Disabled);

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

loop {
info!("Pin level is {}", monitor.get_level());
Timer::after_millis(1000).await;
Expand Down
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/hello-world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
extern crate embassy_imxrt_examples;

use defmt::info;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let _p = embassy_imxrt::init(Default::default());

info!("Hello world");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

loop {
Timer::after_millis(1000).await;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/i2c-loopback-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ async fn main(spawner: Spawner) {

let master = I2cMaster::new_async(p.FLEXCOMM4, p.PIO0_29, p.PIO0_30, Irqs, Speed::Standard, p.DMA0_CH9).unwrap();

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

spawner.must_spawn(master_service(master));
spawner.must_spawn(slave_service(slave));
}
4 changes: 4 additions & 0 deletions examples/rt685s-evk/src/bin/i2c-master-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ async fn main(_spawner: Spawner) {
}

info!("i2c example - Done! Busy Loop...");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

loop {
Timer::after_millis(1000).await;
}
Expand Down
6 changes: 5 additions & 1 deletion examples/rt685s-evk/src/bin/i2c-master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
extern crate embassy_imxrt_examples;

use defmt::{error, info};
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::i2c;
use embassy_time::Timer;
use embedded_hal_1::i2c::I2c;
use {defmt_rtt as _, panic_probe as _};

const ACC_ADDR: u8 = 0x1E;

Expand Down Expand Up @@ -170,6 +170,10 @@ async fn main(_spawner: Spawner) {
}

info!("i2c example - Done! Busy Loop...");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

loop {
Timer::after_millis(1000).await;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/i2c-slave-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@ async fn main(spawner: Spawner) {
info!("i2cs example - I2c::new");
let i2c = I2cSlave::new_async(p.FLEXCOMM2, p.PIO0_18, p.PIO0_17, Irqs, SLAVE_ADDR.unwrap(), p.DMA0_CH4).unwrap();

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

spawner.must_spawn(slave_service(i2c));
}
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/i2c-slave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ async fn main(spawner: Spawner) {
info!("i2cs example - I2c::new");
let i2c = I2cSlave::new_blocking(p.FLEXCOMM2, p.PIO0_18, p.PIO0_17, SLAVE_ADDR.unwrap()).unwrap();

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

spawner.must_spawn(slave_service(i2c));
}
3 changes: 3 additions & 0 deletions examples/rt685s-evk/src/bin/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ async fn main(_spawner: Spawner) {
Timer::after_millis(100).await;
}

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

Timer::after_millis(1000).await;
}
}
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
extern crate embassy_imxrt_examples;

use defmt::*;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::rng::Rng;
use embassy_imxrt::{bind_interrupts, peripherals, rng};
use rand::RngCore;
use {defmt_rtt as _, panic_probe as _};

bind_interrupts!(struct Irqs {
RNG => rng::InterruptHandler<peripherals::RNG>;
Expand All @@ -22,6 +22,9 @@ async fn main(_spawner: Spawner) {
let mut rng = Rng::new(p.RNG, Irqs);
let mut buf = [0u8; 65];

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

// Async interface
unwrap!(rng.async_fill_bytes(&mut buf).await);
info!("random bytes: {:02x}", buf);
Expand Down
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/rtc-time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
extern crate embassy_imxrt_examples;

use defmt::info;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::time_driver::*;
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_imxrt::init(Default::default());
let r = RtcDatetime::new(p.RTC);

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();

let datetime = Datetime {
year: 2024,
month: 10,
Expand Down
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/sha256-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![no_main]

use defmt::*;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::hashcrypt::{hasher, Hashcrypt};
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
Expand Down Expand Up @@ -74,4 +74,7 @@ async fn main(_spawner: Spawner) {
]
);
trace!("Hashes complete");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();
}
5 changes: 4 additions & 1 deletion examples/rt685s-evk/src/bin/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![no_main]

use defmt::*;
use defmt_rtt as _;
use embassy_executor::Spawner;
use embassy_imxrt::hashcrypt::{hasher, Hashcrypt};
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
Expand Down Expand Up @@ -68,4 +68,7 @@ async fn main(_spawner: Spawner) {
]
);
trace!("Hashes complete");

#[cfg(feature = "test-parser")]
test_parser_macros::pass_test();
}
Loading
Loading