From c7a236884589f33fe59b302154dfaa18c9af110c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 4 Oct 2024 08:31:39 +0200 Subject: [PATCH] Print test panics using `semihosting` (#2257) * Print panic messages using semihosting * Don't use defmt's asserts * Make RA_OFFSET available without panic-handler * Re-add defmt imports where missing * Revert unintended test change * Initialise hal in critical-section test * Disable defmt in tests by default --- esp-backtrace/CHANGELOG.md | 2 + esp-backtrace/src/riscv.rs | 6 +- esp-backtrace/src/xtensa.rs | 2 +- hil-test/Cargo.toml | 7 +- hil-test/src/lib.rs | 2 + hil-test/tests/aes.rs | 2 - hil-test/tests/aes_dma.rs | 2 - hil-test/tests/crc.rs | 2 - hil-test/tests/critical_section.rs | 5 + hil-test/tests/dma_macros.rs | 96 +++++++++---------- hil-test/tests/dma_mem2mem.rs | 2 - hil-test/tests/ecc.rs | 2 - hil-test/tests/gpio.rs | 1 - hil-test/tests/i2c.rs | 2 - hil-test/tests/i2s.rs | 5 - hil-test/tests/parl_io_tx.rs | 5 +- hil-test/tests/parl_io_tx_async.rs | 5 +- hil-test/tests/qspi.rs | 1 - hil-test/tests/rsa.rs | 2 - hil-test/tests/rsa_async.rs | 2 - hil-test/tests/sha.rs | 3 - hil-test/tests/spi_full_duplex.rs | 2 - hil-test/tests/spi_half_duplex_read.rs | 2 - hil-test/tests/spi_half_duplex_write.rs | 5 - hil-test/tests/spi_half_duplex_write_psram.rs | 6 +- hil-test/tests/twai.rs | 2 - hil-test/tests/uart.rs | 2 - hil-test/tests/uart_async.rs | 2 - hil-test/tests/uart_tx_rx.rs | 2 - hil-test/tests/uart_tx_rx_async.rs | 2 - 30 files changed, 68 insertions(+), 113 deletions(-) diff --git a/esp-backtrace/CHANGELOG.md b/esp-backtrace/CHANGELOG.md index 8bf2a9764..8487c54af 100644 --- a/esp-backtrace/CHANGELOG.md +++ b/esp-backtrace/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix build when not using `panic-handler` (#2257) + ### Removed ## 0.14.1 - 2024-09-06 diff --git a/esp-backtrace/src/riscv.rs b/esp-backtrace/src/riscv.rs index 9c2092484..9937af03f 100644 --- a/esp-backtrace/src/riscv.rs +++ b/esp-backtrace/src/riscv.rs @@ -4,10 +4,10 @@ use crate::MAX_BACKTRACE_ADDRESSES; // subtract 4 from the return address // the return address is the address following the JALR -// we get better results (especially if the caller was the last function in the -// calling function) if we report the address of the JALR itself +// we get better results (especially if the caller was the last instruction in +// the calling function) if we report the address of the JALR itself // even if it was a C.JALR we should get good results using RA - 4 -#[cfg(feature = "panic-handler")] +#[allow(unused)] pub(super) const RA_OFFSET: usize = 4; /// Registers saved in trap handler diff --git a/esp-backtrace/src/xtensa.rs b/esp-backtrace/src/xtensa.rs index eb0c4425c..62c127d9a 100644 --- a/esp-backtrace/src/xtensa.rs +++ b/esp-backtrace/src/xtensa.rs @@ -6,7 +6,7 @@ use crate::MAX_BACKTRACE_ADDRESSES; // the return address is the address following the callxN // we get better results (especially if the caller was the last function in the // calling function) if we report the address of callxN itself -#[cfg(feature = "panic-handler")] +#[allow(unused)] pub(super) const RA_OFFSET: usize = 3; /// Exception Cause diff --git a/hil-test/Cargo.toml b/hil-test/Cargo.toml index 4dd400b47..466be49eb 100644 --- a/hil-test/Cargo.toml +++ b/hil-test/Cargo.toml @@ -184,11 +184,12 @@ embedded-hal-02 = { version = "0.2.7", package = "embedded-hal", features = [ embedded-hal-async = "1.0.0" embedded-hal-nb = { version = "1.0.0", optional = true } esp-alloc = { path = "../esp-alloc", optional = true } -esp-backtrace = { path = "../esp-backtrace", default-features = false, features = ["exception-handler", "panic-handler", "defmt", "semihosting"] } -esp-hal = { path = "../esp-hal", features = ["defmt", "digest"], optional = true } +esp-backtrace = { path = "../esp-backtrace", default-features = false, features = ["exception-handler", "defmt", "semihosting"] } +esp-hal = { path = "../esp-hal", features = ["digest"], optional = true } esp-hal-embassy = { path = "../esp-hal-embassy", optional = true } portable-atomic = "1.7.0" static_cell = { version = "2.1.0", features = ["nightly"] } +semihosting = { version = "0.1", features= ["stdio", "panic-handler"] } [dev-dependencies] crypto-bigint = { version = "0.5.5", default-features = false } @@ -212,7 +213,7 @@ esp-metadata = { path = "../esp-metadata" } [features] default = ["embassy"] -defmt = ["dep:defmt-rtt", "embedded-test/defmt"] +defmt = ["dep:defmt-rtt", "esp-hal/defmt", "embedded-test/defmt"] # Device support (required!): esp32 = [ diff --git a/hil-test/src/lib.rs b/hil-test/src/lib.rs index 8b0e99ab7..8dbf12173 100644 --- a/hil-test/src/lib.rs +++ b/hil-test/src/lib.rs @@ -6,6 +6,8 @@ // development, and when a test fails. In these cases, you can enable // the `defmt` feature to get the output. +use esp_hal as _; + #[cfg(not(feature = "defmt"))] #[defmt::global_logger] struct Logger; diff --git a/hil-test/tests/aes.rs b/hil-test/tests/aes.rs index cbf90e8ef..67fc6c29c 100644 --- a/hil-test/tests/aes.rs +++ b/hil-test/tests/aes.rs @@ -18,8 +18,6 @@ struct Context<'a> { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/aes_dma.rs b/hil-test/tests/aes_dma.rs index 044cd642c..3d0accd1f 100644 --- a/hil-test/tests/aes_dma.rs +++ b/hil-test/tests/aes_dma.rs @@ -22,8 +22,6 @@ const DMA_BUFFER_SIZE: usize = 16; #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/crc.rs b/hil-test/tests/crc.rs index 68fb5f707..22bd7c204 100644 --- a/hil-test/tests/crc.rs +++ b/hil-test/tests/crc.rs @@ -13,8 +13,6 @@ use hil_test as _; #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/critical_section.rs b/hil-test/tests/critical_section.rs index 00bbf6fc1..e9cad327b 100644 --- a/hil-test/tests/critical_section.rs +++ b/hil-test/tests/critical_section.rs @@ -14,6 +14,11 @@ use hil_test as _; mod tests { use esp_hal::sync::Locked; + #[init] + fn init() { + esp_hal::init(esp_hal::Config::default()); + } + #[test] fn critical_section_is_reentrant() { let mut flag = false; diff --git a/hil-test/tests/dma_macros.rs b/hil-test/tests/dma_macros.rs index bc3a7bbf4..d88b15aed 100644 --- a/hil-test/tests/dma_macros.rs +++ b/hil-test/tests/dma_macros.rs @@ -24,20 +24,20 @@ pub(crate) const fn compute_circular_size(size: usize, chunk_size: usize) -> usi #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; + // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not + // using defmt's non-const assert. Doing so would result in a compile error. + #[allow(unused_imports)] + use defmt::*; use super::*; - #[init] - fn init() {} - #[test] fn test_dma_descriptors_same_size() { use esp_hal::dma::CHUNK_SIZE; let (rx_descriptors, tx_descriptors) = esp_hal::dma_descriptors!(DATA_SIZE); - assert_eq!(rx_descriptors.len(), tx_descriptors.len()); - assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_descriptors.len(), tx_descriptors.len()); + core::assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); } #[test] @@ -46,20 +46,20 @@ mod tests { const RX_SIZE: usize = DATA_SIZE / 2; const TX_SIZE: usize = DATA_SIZE; let (rx_descriptors, tx_descriptors) = esp_hal::dma_descriptors!(RX_SIZE, TX_SIZE); - assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); } #[test] fn test_dma_circular_descriptors_same_size() { use esp_hal::dma::CHUNK_SIZE; let (rx_descriptors, tx_descriptors) = esp_hal::dma_circular_descriptors!(DATA_SIZE); - assert_eq!(rx_descriptors.len(), tx_descriptors.len()); - assert_eq!( + core::assert_eq!(rx_descriptors.len(), tx_descriptors.len()); + core::assert_eq!( rx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); @@ -71,11 +71,11 @@ mod tests { const RX_SIZE: usize = DATA_SIZE / 2; const TX_SIZE: usize = CHUNK_SIZE * 2; let (rx_descriptors, tx_descriptors) = esp_hal::dma_circular_descriptors!(RX_SIZE, TX_SIZE); - assert_eq!( + core::assert_eq!( rx_descriptors.len(), compute_circular_size(RX_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(TX_SIZE, CHUNK_SIZE) ); @@ -86,11 +86,11 @@ mod tests { use esp_hal::dma::CHUNK_SIZE; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_buffers!(DATA_SIZE); - assert_eq!(rx_buffer.len(), DATA_SIZE); - assert_eq!(tx_buffer.len(), DATA_SIZE); - assert_eq!(tx_descriptors.len(), rx_descriptors.len()); - assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_buffer.len(), DATA_SIZE); + core::assert_eq!(tx_buffer.len(), DATA_SIZE); + core::assert_eq!(tx_descriptors.len(), rx_descriptors.len()); + core::assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); } #[test] @@ -101,10 +101,10 @@ mod tests { let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_buffers!(RX_SIZE, TX_SIZE); - assert_eq!(rx_buffer.len(), RX_SIZE); - assert_eq!(tx_buffer.len(), TX_SIZE); - assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_buffer.len(), RX_SIZE); + core::assert_eq!(tx_buffer.len(), TX_SIZE); + core::assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); } #[test] @@ -112,14 +112,14 @@ mod tests { use esp_hal::dma::CHUNK_SIZE; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_circular_buffers!(DATA_SIZE); - assert_eq!(rx_buffer.len(), DATA_SIZE); - assert_eq!(tx_buffer.len(), DATA_SIZE); - assert_eq!(rx_descriptors.len(), tx_descriptors.len()); - assert_eq!( + core::assert_eq!(rx_buffer.len(), DATA_SIZE); + core::assert_eq!(tx_buffer.len(), DATA_SIZE); + core::assert_eq!(rx_descriptors.len(), tx_descriptors.len()); + core::assert_eq!( rx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); @@ -132,13 +132,13 @@ mod tests { const TX_SIZE: usize = CHUNK_SIZE * 4; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_circular_buffers!(RX_SIZE, TX_SIZE); - assert_eq!(rx_buffer.len(), RX_SIZE); - assert_eq!(tx_buffer.len(), TX_SIZE); - assert_eq!( + core::assert_eq!(rx_buffer.len(), RX_SIZE); + core::assert_eq!(tx_buffer.len(), TX_SIZE); + core::assert_eq!( rx_descriptors.len(), compute_circular_size(RX_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(TX_SIZE, CHUNK_SIZE) ); @@ -149,9 +149,9 @@ mod tests { const CHUNK_SIZE: usize = 2048; let (rx_descriptors, tx_descriptors) = esp_hal::dma_descriptors_chunk_size!(DATA_SIZE, CHUNK_SIZE); - assert_eq!(rx_descriptors.len(), tx_descriptors.len()); - assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_descriptors.len(), tx_descriptors.len()); + core::assert_eq!(rx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(DATA_SIZE, CHUNK_SIZE)); } #[test] @@ -161,8 +161,8 @@ mod tests { const TX_SIZE: usize = DATA_SIZE; let (rx_descriptors, tx_descriptors) = esp_hal::dma_descriptors_chunk_size!(RX_SIZE, TX_SIZE, CHUNK_SIZE); - assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); - assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); + core::assert_eq!(rx_descriptors.len(), compute_size(RX_SIZE, CHUNK_SIZE)); + core::assert_eq!(tx_descriptors.len(), compute_size(TX_SIZE, CHUNK_SIZE)); } #[test] @@ -170,14 +170,14 @@ mod tests { const CHUNK_SIZE: usize = 2048; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_circular_buffers_chunk_size!(DATA_SIZE, CHUNK_SIZE); - assert_eq!(rx_buffer.len(), DATA_SIZE); - assert_eq!(tx_buffer.len(), DATA_SIZE); - assert_eq!(rx_descriptors.len(), tx_descriptors.len()); - assert_eq!( + core::assert_eq!(rx_buffer.len(), DATA_SIZE); + core::assert_eq!(tx_buffer.len(), DATA_SIZE); + core::assert_eq!(rx_descriptors.len(), tx_descriptors.len()); + core::assert_eq!( rx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(DATA_SIZE, CHUNK_SIZE) ); @@ -190,13 +190,13 @@ mod tests { const TX_SIZE: usize = DATA_SIZE; let (rx_buffer, rx_descriptors, tx_buffer, tx_descriptors) = esp_hal::dma_circular_buffers_chunk_size!(RX_SIZE, TX_SIZE, CHUNK_SIZE); - assert_eq!(rx_buffer.len(), RX_SIZE); - assert_eq!(tx_buffer.len(), TX_SIZE); - assert_eq!( + core::assert_eq!(rx_buffer.len(), RX_SIZE); + core::assert_eq!(tx_buffer.len(), TX_SIZE); + core::assert_eq!( rx_descriptors.len(), compute_circular_size(RX_SIZE, CHUNK_SIZE) ); - assert_eq!( + core::assert_eq!( tx_descriptors.len(), compute_circular_size(TX_SIZE, CHUNK_SIZE) ); @@ -210,10 +210,10 @@ mod tests { fn check(result: Result, size: usize) { match result { Ok(tx_buf) => { - assert_eq!(tx_buf.len(), size); + core::assert_eq!(tx_buf.len(), size); } Err(_) => { - panic!("Failed to create DmaTxBuf"); + core::panic!("Failed to create DmaTxBuf"); } } } diff --git a/hil-test/tests/dma_mem2mem.rs b/hil-test/tests/dma_mem2mem.rs index 656e89bfb..9abd073db 100644 --- a/hil-test/tests/dma_mem2mem.rs +++ b/hil-test/tests/dma_mem2mem.rs @@ -34,8 +34,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/ecc.rs b/hil-test/tests/ecc.rs index 13e97740c..04a36dfac 100644 --- a/hil-test/tests/ecc.rs +++ b/hil-test/tests/ecc.rs @@ -50,8 +50,6 @@ struct Context<'a> { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/gpio.rs b/hil-test/tests/gpio.rs index 6a9adcd50..5b75eefe4 100644 --- a/hil-test/tests/gpio.rs +++ b/hil-test/tests/gpio.rs @@ -41,7 +41,6 @@ pub fn interrupt_handler() { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - use defmt::assert_eq; use embassy_time::{Duration, Timer}; use esp_hal::gpio::{Event, Flex, OutputOpenDrain}; use portable_atomic::{AtomicUsize, Ordering}; diff --git a/hil-test/tests/i2c.rs b/hil-test/tests/i2c.rs index da2577df4..8e07e2b20 100644 --- a/hil-test/tests/i2c.rs +++ b/hil-test/tests/i2c.rs @@ -14,8 +14,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_ne; - use super::*; #[init] diff --git a/hil-test/tests/i2s.rs b/hil-test/tests/i2s.rs index e6e73fa0b..537e66221 100644 --- a/hil-test/tests/i2s.rs +++ b/hil-test/tests/i2s.rs @@ -101,11 +101,6 @@ fn enable_loopback() { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not - // using defmt's non-const assert. Doing so would result in a compile error. - #[allow(unused_imports)] - use defmt::{assert, assert_eq, *}; - use super::*; struct Context { diff --git a/hil-test/tests/parl_io_tx.rs b/hil-test/tests/parl_io_tx.rs index a4efbb3c1..3bec7b56c 100644 --- a/hil-test/tests/parl_io_tx.rs +++ b/hil-test/tests/parl_io_tx.rs @@ -40,10 +40,7 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not - // using defmt's non-const assert. Doing so would result in a compile error. - #[allow(unused_imports)] - use defmt::{assert_eq, *}; + use defmt::info; use super::*; diff --git a/hil-test/tests/parl_io_tx_async.rs b/hil-test/tests/parl_io_tx_async.rs index 22d9b989b..cdb177a48 100644 --- a/hil-test/tests/parl_io_tx_async.rs +++ b/hil-test/tests/parl_io_tx_async.rs @@ -42,10 +42,7 @@ struct Context { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not - // using defmt's non-const assert. Doing so would result in a compile error. - #[allow(unused_imports)] - use defmt::{assert_eq, *}; + use defmt::info; use super::*; diff --git a/hil-test/tests/qspi.rs b/hil-test/tests/qspi.rs index e88c421f3..af9132bed 100644 --- a/hil-test/tests/qspi.rs +++ b/hil-test/tests/qspi.rs @@ -5,7 +5,6 @@ #![no_std] #![no_main] -use defmt::assert_eq; #[cfg(pcnt)] use esp_hal::pcnt::{channel::EdgeMode, unit::Unit, Pcnt}; use esp_hal::{ diff --git a/hil-test/tests/rsa.rs b/hil-test/tests/rsa.rs index 6651caea2..fed0ffcb6 100644 --- a/hil-test/tests/rsa.rs +++ b/hil-test/tests/rsa.rs @@ -51,8 +51,6 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/rsa_async.rs b/hil-test/tests/rsa_async.rs index 45c57a7d0..105f424e2 100644 --- a/hil-test/tests/rsa_async.rs +++ b/hil-test/tests/rsa_async.rs @@ -51,8 +51,6 @@ const fn compute_mprime(modulus: &U512) -> u32 { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/sha.rs b/hil-test/tests/sha.rs index b89afed8b..157592af3 100644 --- a/hil-test/tests/sha.rs +++ b/hil-test/tests/sha.rs @@ -160,9 +160,6 @@ pub struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - #[cfg(any(feature = "esp32s2", feature = "esp32s3"))] - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/spi_full_duplex.rs b/hil-test/tests/spi_full_duplex.rs index 00b5e579f..76ee33a90 100644 --- a/hil-test/tests/spi_full_duplex.rs +++ b/hil-test/tests/spi_full_duplex.rs @@ -46,8 +46,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/spi_half_duplex_read.rs b/hil-test/tests/spi_half_duplex_read.rs index 22fbc6848..48e5dc3d4 100644 --- a/hil-test/tests/spi_half_duplex_read.rs +++ b/hil-test/tests/spi_half_duplex_read.rs @@ -37,8 +37,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/spi_half_duplex_write.rs b/hil-test/tests/spi_half_duplex_write.rs index e9d4653f4..fb6cc0fcf 100644 --- a/hil-test/tests/spi_half_duplex_write.rs +++ b/hil-test/tests/spi_half_duplex_write.rs @@ -42,11 +42,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not - // using defmt's non-const assert. Doing so would result in a compile error. - #[allow(unused_imports)] - use defmt::{assert_eq, *}; - use super::*; #[init] diff --git a/hil-test/tests/spi_half_duplex_write_psram.rs b/hil-test/tests/spi_half_duplex_write_psram.rs index a63d8b335..eb7987e23 100644 --- a/hil-test/tests/spi_half_duplex_write_psram.rs +++ b/hil-test/tests/spi_half_duplex_write_psram.rs @@ -4,6 +4,7 @@ #![no_std] #![no_main] +use defmt::error; use esp_alloc as _; use esp_hal::{ dma::{Dma, DmaBufBlkSize, DmaPriority, DmaRxBuf, DmaTxBuf}, @@ -58,11 +59,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - // defmt::* is load-bearing, it ensures that the assert in dma_buffers! is not - // using defmt's non-const assert. Doing so would result in a compile error. - #[allow(unused_imports)] - use defmt::{assert_eq, *}; - use super::*; #[init] diff --git a/hil-test/tests/twai.rs b/hil-test/tests/twai.rs index 6bb6f9c1c..ba258c81e 100644 --- a/hil-test/tests/twai.rs +++ b/hil-test/tests/twai.rs @@ -23,8 +23,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/uart.rs b/hil-test/tests/uart.rs index 3261e5953..7cc26a560 100644 --- a/hil-test/tests/uart.rs +++ b/hil-test/tests/uart.rs @@ -23,8 +23,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/uart_async.rs b/hil-test/tests/uart_async.rs index 4aed1b44e..fa7d24d66 100644 --- a/hil-test/tests/uart_async.rs +++ b/hil-test/tests/uart_async.rs @@ -16,8 +16,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/uart_tx_rx.rs b/hil-test/tests/uart_tx_rx.rs index 45eab81ef..139631e7e 100644 --- a/hil-test/tests/uart_tx_rx.rs +++ b/hil-test/tests/uart_tx_rx.rs @@ -23,8 +23,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests] mod tests { - use defmt::assert_eq; - use super::*; #[init] diff --git a/hil-test/tests/uart_tx_rx_async.rs b/hil-test/tests/uart_tx_rx_async.rs index 8cb95936c..fed411104 100644 --- a/hil-test/tests/uart_tx_rx_async.rs +++ b/hil-test/tests/uart_tx_rx_async.rs @@ -22,8 +22,6 @@ struct Context { #[cfg(test)] #[embedded_test::tests(executor = esp_hal_embassy::Executor::new())] mod tests { - use defmt::assert_eq; - use super::*; #[init]