Test that all PSRAM is unsable (#3210)

This commit is contained in:
Dániel Buga 2025-03-05 11:46:54 +01:00 committed by GitHub
parent e657aeb228
commit d9c32d5c29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ use hil_test as _;
extern crate alloc;
#[cfg(test)]
#[embedded_test::tests(default_timeout = 2)]
#[embedded_test::tests]
mod tests {
#[init]
fn init() {
@ -34,4 +34,19 @@ mod tests {
assert_eq!(vec[i], i);
}
}
#[test]
fn all_psram_is_usable() {
let free = esp_alloc::HEAP.free();
defmt::info!("Free: {}", free);
let mut vec = alloc::vec::Vec::with_capacity(free);
for i in 0..free {
vec.push((i % 256) as u8);
}
for i in 0..free {
assert_eq!(vec[i], (i % 256) as u8);
}
}
}