ci(test): Fix PSRAM test

This commit is contained in:
Lucas Saavedra Vaz 2025-02-21 23:47:01 -03:00
parent 003db9e4c0
commit 543a647f2c
No known key found for this signature in database
GPG key ID: 9CAE85DC84A38188
2 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1,24 @@
{
"version": 1,
"author": "lucasssvaz",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-s3-devkitc-1",
"id": "esp",
"attrs": { "psramType": "octal" }
}
],
"connections": [
[
"esp:TX",
"$serialMonitor:RX",
""
],
[
"esp:RX",
"$serialMonitor:TX",
""
]
]
}

View file

@ -4,6 +4,12 @@
#define MAX_TEST_SIZE 512 * 1024 // 512KB
void *buf = NULL;
uint32_t psram_size = 0;
void psram_found(void) {
psram_size = ESP.getPsramSize();
TEST_ASSERT_TRUE(psram_size > 0);
}
void test_malloc_success(void) {
buf = ps_malloc(MAX_TEST_SIZE);
@ -96,6 +102,13 @@ void setup() {
}
UNITY_BEGIN();
RUN_TEST(psram_found);
if (psram_size == 0) {
UNITY_END();
return;
}
RUN_TEST(test_malloc_success);
RUN_TEST(test_malloc_fail);
RUN_TEST(test_calloc_success);
@ -104,7 +117,8 @@ void setup() {
RUN_TEST(test_memset_all_zeroes);
RUN_TEST(test_memset_all_ones);
RUN_TEST(test_memset_alternating);
RUN_TEST(test_memset_random);
//This test is disabled because it takes too long to run on some wokwi boards
//RUN_TEST(test_memset_random);
RUN_TEST(test_memcpy);
UNITY_END();
}