ci: fix "can set sleep wake stub from stack in RTC RAM" test case failure

"can set sleep wake stub from stack in RTC RAM" would randomly fail on S3 due to stack overflow.

Fixed wrong usage of stack size and slightly increased it.
pull/7796/head
Marius Vikhammer 2021-11-25 10:02:49 +08:00
rodzic 9044374032
commit 469d047aeb
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -324,11 +324,12 @@ static void prepare_wake_stub_from_rtc(void)
a memory capability (as it's an implementation detail). So to test this we need to allocate
the stack statically.
*/
#define STACK_SIZE 1500
#if CONFIG_IDF_TARGET_ESP32S3
uint8_t *sleep_stack = (uint8_t *)heap_caps_malloc(1024, MALLOC_CAP_RTCRAM);
uint8_t *sleep_stack = (uint8_t *)heap_caps_malloc(STACK_SIZE, MALLOC_CAP_RTCRAM);
TEST_ASSERT((uint32_t)sleep_stack >= SOC_RTC_DRAM_LOW && (uint32_t)sleep_stack < SOC_RTC_DRAM_HIGH);
#else
static RTC_FAST_ATTR uint8_t sleep_stack[1024];
static RTC_FAST_ATTR uint8_t sleep_stack[STACK_SIZE];
#endif
static RTC_FAST_ATTR StaticTask_t sleep_task;
@ -336,7 +337,7 @@ static void prepare_wake_stub_from_rtc(void)
* wake from deep sleep. So to ensure unused stack is different if test is re-run without a full reset,
* fill with some random bytes
*/
esp_fill_random(sleep_stack, sizeof(sleep_stack));
esp_fill_random(sleep_stack, STACK_SIZE);
/* to make things extra sure, start a periodic timer to write to RTC FAST RAM at high frequency */
const esp_timer_create_args_t timer_args = {
@ -350,7 +351,7 @@ static void prepare_wake_stub_from_rtc(void)
ESP_ERROR_CHECK( esp_timer_start_periodic(timer, 200) );
printf("Creating test task with stack %p\n", sleep_stack);
TEST_ASSERT_NOT_NULL(xTaskCreateStatic( (void *)prepare_wake_stub, "sleep", sizeof(sleep_stack), NULL,
TEST_ASSERT_NOT_NULL(xTaskCreateStatic( (void *)prepare_wake_stub, "sleep", STACK_SIZE, NULL,
UNITY_FREERTOS_PRIORITY, sleep_stack, &sleep_task));
vTaskDelay(1000 / portTICK_PERIOD_MS);
TEST_FAIL_MESSAGE("Should be asleep by now");