mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
6582f7070e
- Place panic_abort in IRAM - Added abort, assert test case in case of cache disabled - Expect assert instead of abort in a freertos_mutex test
26 lines
812 B
C
26 lines
812 B
C
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/semphr.h"
|
|
#include "unity.h"
|
|
#include "test_utils.h"
|
|
|
|
/* If assertions aren't set to fail this code still crashes, but not with an abort... */
|
|
#if CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER && CONFIG_FREERTOS_ASSERT_FAIL_ABORT
|
|
|
|
static void mutex_release_task(void* arg)
|
|
{
|
|
SemaphoreHandle_t mutex = (SemaphoreHandle_t) arg;
|
|
xSemaphoreGive(mutex);
|
|
TEST_FAIL_MESSAGE("should not be reached");
|
|
}
|
|
|
|
TEST_CASE("mutex released not by owner causes an assert", "[freertos][reset=assert,SW_CPU_RESET]")
|
|
{
|
|
SemaphoreHandle_t mutex = xSemaphoreCreateMutex();
|
|
xSemaphoreTake(mutex, portMAX_DELAY);
|
|
xTaskCreate(&mutex_release_task, "mutex_release", 2048, mutex, UNITY_FREERTOS_PRIORITY + 1, NULL);
|
|
vTaskDelay(1);
|
|
}
|
|
|
|
#endif
|