Skip to content

Commit e169731

Browse files
authored
Refactor SPI tests & re-enable S3 and some S2 (#1990)
* Deduplicate spi_full_duplex_dma_async * Refactor SPI tests * Separate out PCNT tests * Re-enable test on S3 * Re-enable some S2 tests
1 parent d0f98b6 commit e169731

File tree

7 files changed

+456
-460
lines changed

7 files changed

+456
-460
lines changed

hil-test/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ harness = false
7979
name = "spi_full_duplex_dma_async"
8080
harness = false
8181

82+
[[test]]
83+
name = "spi_full_duplex_dma_pcnt"
84+
harness = false
85+
8286
[[test]]
8387
name = "spi_half_duplex_read"
8488
harness = false

hil-test/tests/spi_full_duplex.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ struct Context {
2828
spi: Spi<'static, esp_hal::peripherals::SPI2, FullDuplexMode>,
2929
}
3030

31-
impl Context {
32-
pub fn init() -> Self {
31+
#[cfg(test)]
32+
#[embedded_test::tests]
33+
mod tests {
34+
use defmt::assert_eq;
35+
36+
use super::*;
37+
38+
#[init]
39+
fn init() -> Context {
3340
let peripherals = Peripherals::take();
3441
let system = SystemControl::new(peripherals.SYSTEM);
3542
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
@@ -49,19 +56,6 @@ impl Context {
4956

5057
Context { spi }
5158
}
52-
}
53-
54-
#[cfg(test)]
55-
#[embedded_test::tests]
56-
mod tests {
57-
use defmt::assert_eq;
58-
59-
use super::*;
60-
61-
#[init]
62-
fn init() -> Context {
63-
Context::init()
64-
}
6559

6660
#[test]
6761
#[timeout(3)]

0 commit comments

Comments
 (0)