mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
heap: added test case for realloc to verify if successive realloc in IRAM still ends there.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
|
#include "soc/soc_memory_layout.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_HEAP_POISONING_COMPREHENSIVE
|
#ifndef CONFIG_HEAP_POISONING_COMPREHENSIVE
|
||||||
@@ -22,6 +23,21 @@ TEST_CASE("realloc shrink buffer in place", "[heap]")
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap]")
|
||||||
|
{
|
||||||
|
const size_t buffer_size = 64;
|
||||||
|
|
||||||
|
void *x = heap_caps_malloc(buffer_size, MALLOC_CAP_EXEC);
|
||||||
|
TEST_ASSERT(x);
|
||||||
|
void *y = heap_caps_realloc(x, buffer_size - 16, MALLOC_CAP_EXEC);
|
||||||
|
TEST_ASSERT(y);
|
||||||
|
|
||||||
|
//y needs to fall in a compatible memory area of IRAM:
|
||||||
|
TEST_ASSERT(esp_ptr_executable(y));
|
||||||
|
|
||||||
|
free(y);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("realloc move data to a new heap type", "[heap]")
|
TEST_CASE("realloc move data to a new heap type", "[heap]")
|
||||||
{
|
{
|
||||||
const char *test = "I am some test content to put in the heap";
|
const char *test = "I am some test content to put in the heap";
|
||||||
|
Reference in New Issue
Block a user