heap: RE-enable ESP32C2 test in test_apps

This commit is contained in:
Guillaume Souchere
2022-12-14 09:22:01 +01:00
parent 490216a2ac
commit 327bf0d608
4 changed files with 21 additions and 18 deletions

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* /*
Tests for D/IRAM support in heap capability allocator Tests for D/IRAM support in heap capability allocator
*/ */
@ -10,8 +15,7 @@
#define ALLOC_SZ 1024 #define ALLOC_SZ 1024
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
//IDF-5167
static void *malloc_block_diram(uint32_t caps) static void *malloc_block_diram(uint32_t caps)
{ {
void *attempts[256] = { 0 }; // Allocate up to 256 ALLOC_SZ blocks to exhaust all non-D/IRAM memory temporarily void *attempts[256] = { 0 }; // Allocate up to 256 ALLOC_SZ blocks to exhaust all non-D/IRAM memory temporarily
@ -74,4 +78,4 @@ TEST_CASE("Allocate D/IRAM as IRAM", "[heap]")
free(iram); free(iram);
} }
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* /*
Tests for the capabilities-based memory allocator. Tests for the capabilities-based memory allocator.
*/ */
@ -13,9 +18,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/param.h> #include <sys/param.h>
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
//IDF-5167
#ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE #ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
TEST_CASE("Capabilities allocator test", "[heap]") TEST_CASE("Capabilities allocator test", "[heap]")
{ {
@ -106,8 +108,7 @@ TEST_CASE("Capabilities allocator test", "[heap]")
free(m1); free(m1);
printf("Done.\n"); printf("Done.\n");
} }
#endif #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
#ifdef CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY #ifdef CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
TEST_CASE("IRAM_8BIT capability test", "[heap]") TEST_CASE("IRAM_8BIT capability test", "[heap]")
@ -170,11 +171,10 @@ TEST_CASE("heap_caps metadata test", "[heap]")
TEST_ASSERT(after.minimum_free_bytes < original.total_free_bytes); TEST_ASSERT(after.minimum_free_bytes < original.total_free_bytes);
} }
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
//IDF-5167
/* Small function runs from IRAM to check that malloc/free/realloc /* Small function runs from IRAM to check that malloc/free/realloc
all work OK when cache is disabled... all work OK when cache is disabled...
*/ */
#ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
static IRAM_ATTR __attribute__((noinline)) bool iram_malloc_test(void) static IRAM_ATTR __attribute__((noinline)) bool iram_malloc_test(void)
{ {
spi_flash_guard_get()->start(); // Disables flash cache spi_flash_guard_get()->start(); // Disables flash cache
@ -196,7 +196,7 @@ TEST_CASE("heap_caps_xxx functions work with flash cache disabled", "[heap]")
{ {
TEST_ASSERT( iram_malloc_test() ); TEST_ASSERT( iram_malloc_test() );
} }
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2) #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
#ifdef CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS #ifdef CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS
TEST_CASE("When enabled, allocation operation failure generates an abort", "[heap][reset=abort,SW_CPU_RESET]") TEST_CASE("When enabled, allocation operation failure generates an abort", "[heap][reset=abort,SW_CPU_RESET]")

View File

@ -1,3 +1,8 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
/* /*
Generic test for realloc Generic test for realloc
*/ */
@ -23,8 +28,6 @@ TEST_CASE("realloc shrink buffer in place", "[heap]")
#endif #endif
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
//IDF-5167
#ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE #ifndef CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap]") TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap]")
{ {
@ -64,5 +67,4 @@ TEST_CASE("realloc move data to a new heap type", "[heap]")
free(c); free(c);
} }
#endif #endif // CONFIG_ESP_SYSTEM_MEMPROT_FEATURE
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)

View File

@ -789,12 +789,9 @@ components/heap/include/esp_heap_trace.h
components/heap/include/heap_memory_layout.h components/heap/include/heap_memory_layout.h
components/heap/test/test_aligned_alloc_caps.c components/heap/test/test_aligned_alloc_caps.c
components/heap/test/test_allocator_timings.c components/heap/test/test_allocator_timings.c
components/heap/test/test_diram.c
components/heap/test/test_heap_trace.c components/heap/test/test_heap_trace.c
components/heap/test/test_leak.c components/heap/test/test_leak.c
components/heap/test/test_malloc.c components/heap/test/test_malloc.c
components/heap/test/test_malloc_caps.c
components/heap/test/test_realloc.c
components/heap/test/test_runtime_heap_reg.c components/heap/test/test_runtime_heap_reg.c
components/heap/test_multi_heap_host/main.cpp components/heap/test_multi_heap_host/main.cpp
components/heap/test_multi_heap_host/test_multi_heap.cpp components/heap/test_multi_heap_host/test_multi_heap.cpp