Skip to content

Commit

Permalink
Refactor SPI tests & re-enable S3 and some S2 (#1990)
Browse files Browse the repository at this point in the history
* Deduplicate spi_full_duplex_dma_async

* Refactor SPI tests

* Separate out PCNT tests

* Re-enable test on S3

* Re-enable some S2 tests
  • Loading branch information
bugadani authored Aug 26, 2024
1 parent d0f98b6 commit e169731
Show file tree
Hide file tree
Showing 7 changed files with 456 additions and 460 deletions.
4 changes: 4 additions & 0 deletions hil-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ harness = false
name = "spi_full_duplex_dma_async"
harness = false

[[test]]
name = "spi_full_duplex_dma_pcnt"
harness = false

[[test]]
name = "spi_half_duplex_read"
harness = false
Expand Down
24 changes: 9 additions & 15 deletions hil-test/tests/spi_full_duplex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ struct Context {
spi: Spi<'static, esp_hal::peripherals::SPI2, FullDuplexMode>,
}

impl Context {
pub fn init() -> Self {
#[cfg(test)]
#[embedded_test::tests]
mod tests {
use defmt::assert_eq;

use super::*;

#[init]
fn init() -> Context {
let peripherals = Peripherals::take();
let system = SystemControl::new(peripherals.SYSTEM);
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
Expand All @@ -49,19 +56,6 @@ impl Context {

Context { spi }
}
}

#[cfg(test)]
#[embedded_test::tests]
mod tests {
use defmt::assert_eq;

use super::*;

#[init]
fn init() -> Context {
Context::init()
}

#[test]
#[timeout(3)]
Expand Down
Loading

0 comments on commit e169731

Please sign in to comment.