From 3057b76a7ef6da7a634ffe30b678368f93b4eb8a Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Thu, 24 Sep 2020 17:25:52 -0300 Subject: [PATCH] tests: re-add all disabled tests and all disabled configurations --- .gitignore | 5 +- components/driver/spi_master.c | 2 +- components/driver/test/test_spi_master.c | 4 +- components/freertos/Kconfig | 2 +- components/freertos/License/license.txt | 37 -------- .../freertos/include/freertos/portable.h | 17 +--- components/freertos/stdint.readme | 27 ------ .../freertos/test/test_freertos_eventgroups.c | 2 - .../freertos/test/test_freertos_get_state.c | 6 +- .../xtensa/include/freertos/portmacro.h | 22 ++--- components/freertos/xtensa/xtensa_vectors.S | 85 ------------------- components/heap/heap_caps.c | 2 +- components/heap/include/esp_heap_caps.h | 3 - components/heap/multi_heap.c | 4 +- components/heap/test/test_malloc_caps.c | 3 - components/heap/test/test_realloc.c | 4 +- .../test_multi_heap_host/test_multi_heap.cpp | 31 +++---- components/newlib/heap.c | 1 - components/soc/include/soc/spinlock.h | 2 +- components/wear_levelling/test/test_wl.c | 2 +- .../components/test_utils/ref_clock.c | 2 +- tools/unit-test-app/configs/default | 2 +- 22 files changed, 40 insertions(+), 225 deletions(-) delete mode 100644 components/freertos/License/license.txt delete mode 100644 components/freertos/stdint.readme diff --git a/.gitignore b/.gitignore index a32c925ff5..99d3ecf01f 100644 --- a/.gitignore +++ b/.gitignore @@ -87,7 +87,4 @@ flake8_output.txt build # lock files for examples and components -dependencies.lock - -# gdbinit files: -gdbinit +dependencies.lock \ No newline at end of file diff --git a/components/driver/spi_master.c b/components/driver/spi_master.c index 870a126234..ae2e9a96e2 100644 --- a/components/driver/spi_master.c +++ b/components/driver/spi_master.c @@ -714,7 +714,7 @@ static SPI_MASTER_ISR_ATTR void uninstall_priv_desc(spi_trans_priv_t* trans_buf) { spi_transaction_t *trans_desc = trans_buf->trans; if ((void *)trans_buf->buffer_to_send != &trans_desc->tx_data[0] && - trans_buf->buffer_to_send != trans_desc->tx_buffer) { // NOLINT(clang-analyzer-unix.Malloc) + trans_buf->buffer_to_send != trans_desc->tx_buffer) { free((void *)trans_buf->buffer_to_send); //force free, ignore const } // copy data from temporary DMA-capable buffer back to IRAM buffer and free the temporary one. diff --git a/components/driver/test/test_spi_master.c b/components/driver/test/test_spi_master.c index 8156d6aadc..ccc6270190 100644 --- a/components/driver/test/test_spi_master.c +++ b/components/driver/test/test_spi_master.c @@ -544,7 +544,7 @@ static const uint8_t data_drom[320+3] = { 0x70, 0x22, 0x7D, 0x0A, 0x6D, 0xD3, 0x77, 0x73, 0xD0, 0xF4, 0x06, 0xB2, 0x19, 0x8C, 0xFF, 0x58, 0xE4, 0xDB, 0xE9, 0xEC, 0x89, 0x6A, 0xF4, 0x0E, 0x67, 0x12, 0xEC, 0x11, 0xD2, 0x1F, 0x8D, 0xD7, }; -TEST_CASE("SPI Master DMA test, TX and RX in different regions", "[spi][ignore]") +TEST_CASE("SPI Master DMA test, TX and RX in different regions", "[spi]") { #ifdef CONFIG_SPIRAM //test psram if enabled @@ -564,7 +564,7 @@ TEST_CASE("SPI Master DMA test, TX and RX in different regions", "[spi][ignore]" ESP_LOGI(TAG, "iram: %p, dram: %p", data_iram, data_dram); ESP_LOGI(TAG, "drom: %p, malloc: %p", data_drom, data_malloc); TEST_ASSERT(esp_ptr_in_dram(data_dram)); - TEST_ASSERT(esp_ptr_in_iram(data_iram)); + TEST_ASSERT(esp_ptr_executable(data_iram) || esp_ptr_in_iram(data_iram) || esp_ptr_in_diram_iram(data_iram)); TEST_ASSERT(esp_ptr_in_drom(data_drom)); srand(52); diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index af633b7ac6..a369f2ad33 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -163,7 +163,7 @@ menu "FreeRTOS" config FREERTOS_IDLE_TASK_STACKSIZE int "Idle Task stack size" range 768 32768 - default 1536 + default 2304 help The idle task has its own stack, sized in bytes. The default size is enough for most uses. Size can be reduced to 768 bytes if no (or simple) FreeRTOS idle hooks are used and pthread local storage or FreeRTOS diff --git a/components/freertos/License/license.txt b/components/freertos/License/license.txt deleted file mode 100644 index 2977d52f60..0000000000 --- a/components/freertos/License/license.txt +++ /dev/null @@ -1,37 +0,0 @@ -The FreeRTOS kernel is released under the MIT open source license, the text of -which is provided below. - -This license covers the FreeRTOS kernel source files, which are located in the -/FreeRTOS/Source directory of the official FreeRTOS kernel download. It also -covers most of the source files in the demo application projects, which are -located in the /FreeRTOS/Demo directory of the official FreeRTOS download. The -demo projects may also include third party software that is not part of FreeRTOS -and is licensed separately to FreeRTOS. Examples of third party software -includes header files provided by chip or tools vendors, linker scripts, -peripheral drivers, etc. All the software in subdirectories of the /FreeRTOS -directory is either open source or distributed with permission, and is free for -use. For the avoidance of doubt, refer to the comments at the top of each -source file. - - -License text: -------------- - -Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/components/freertos/include/freertos/portable.h b/components/freertos/include/freertos/portable.h index 954a915ff0..dce07473fd 100644 --- a/components/freertos/include/freertos/portable.h +++ b/components/freertos/include/freertos/portable.h @@ -98,9 +98,6 @@ extern "C" { #include "mpu_wrappers.h" -#include "hal/cpu_hal.h" -#include "xt_instr_macros.h" - /* * Setup the stack of a new task so it is ready to be placed under the * scheduler control. The registers have to be placed on the stack in @@ -170,7 +167,7 @@ void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; -#else +#else // configUSE_FREERTOS_PROVIDED_HEAP /* * Map to the memory management routines required for the port. @@ -199,18 +196,6 @@ BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; */ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; -/* - * The structures and methods of manipulating the MPU are contained within the - * port layer. - * - * Fills the xMPUSettings structure with the memory region information - * contained in xRegions. - */ -#if( portUSING_MPU_WRAPPERS == 1 ) - struct xMEMORY_REGION; - void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; -#endif - #ifdef __cplusplus } #endif diff --git a/components/freertos/stdint.readme b/components/freertos/stdint.readme deleted file mode 100644 index 4414c29ed2..0000000000 --- a/components/freertos/stdint.readme +++ /dev/null @@ -1,27 +0,0 @@ - -#ifndef FREERTOS_STDINT -#define FREERTOS_STDINT - -/******************************************************************************* - * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions - * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be - * built using compilers that do not provide their own stdint.h definition. - * - * To use this file: - * - * 1) Copy this file into the directory that contains your FreeRTOSConfig.h - * header file, as that directory will already be in the compilers include - * path. - * - * 2) Rename the copied file stdint.h. - * - */ - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef long int32_t; -typedef unsigned long uint32_t; - -#endif /* FREERTOS_STDINT */ diff --git a/components/freertos/test/test_freertos_eventgroups.c b/components/freertos/test/test_freertos_eventgroups.c index 0764c00474..db298504c0 100644 --- a/components/freertos/test/test_freertos_eventgroups.c +++ b/components/freertos/test/test_freertos_eventgroups.c @@ -126,7 +126,6 @@ TEST_CASE("FreeRTOS Event Group Sync", "[freertos]") /*-----------------Test case for event group trace facilities-----------------*/ #ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY -#ifndef CONFIG_SPIRAM /* * Test event group Trace Facility functions such as * xEventGroupClearBitsFromISR(), xEventGroupSetBitsFromISR() @@ -218,5 +217,4 @@ TEST_CASE("FreeRTOS Event Group ISR", "[freertos]") vSemaphoreDelete(done_sem); vTaskDelay(10); //Give time for idle task to clear up deleted tasks } -#endif #endif //CONFIG_FREERTOS_USE_TRACE_FACILITY diff --git a/components/freertos/test/test_freertos_get_state.c b/components/freertos/test/test_freertos_get_state.c index ca197fcc49..d8a8ef7421 100644 --- a/components/freertos/test/test_freertos_get_state.c +++ b/components/freertos/test/test_freertos_get_state.c @@ -19,7 +19,7 @@ void test_task_get_state(void* arg) //Idle task of current core should return eReady TEST_ASSERT(eTaskGetState(xTaskGetIdleTaskHandle()) == eReady); //Blocked Task should return eBlocked - TEST_ASSERT(eTaskGetState(blocked_task_handle) == eSuspended); + TEST_ASSERT(eTaskGetState(blocked_task_handle) == eBlocked); //Suspended Task should return eSuspended TEST_ASSERT(eTaskGetState(suspended_task_handle) == eSuspended); @@ -29,8 +29,10 @@ void test_task_get_state(void* arg) void blocked_task(void *arg) { + uint32_t notify_value; + while(1){ - vTaskDelay(portMAX_DELAY); + xTaskNotifyWait(0, 0xFFFFFFFF, ¬ify_value, portMAX_DELAY); } } diff --git a/components/freertos/xtensa/include/freertos/portmacro.h b/components/freertos/xtensa/include/freertos/portmacro.h index f6e4c315e4..e144bc08c4 100644 --- a/components/freertos/xtensa/include/freertos/portmacro.h +++ b/components/freertos/xtensa/include/freertos/portmacro.h @@ -90,13 +90,13 @@ extern "C" { #include "esp_rom_sys.h" #include "sdkconfig.h" #include "freertos/xtensa_api.h" +#include "esp_system.h" +#include "soc/cpu.h" +#include #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS #include "soc/soc_memory_layout.h" #endif -#include "esp_system.h" -#include "soc/cpu.h" -#include /*----------------------------------------------------------- * Port specific definitions. @@ -137,10 +137,6 @@ typedef unsigned portBASE_TYPE UBaseType_t; #include "sdkconfig.h" #include "esp_attr.h" - -#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() -void vPortAssertIfInISR(void); - // Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. // They can be called from interrupts too. // WARNING: Only applies to current CPU. See notes above. @@ -185,9 +181,6 @@ typedef spinlock_t portMUX_TYPE; #define portMUX_TRY_LOCK SPINLOCK_NO_WAIT /* Try to acquire the spinlock a single time only */ #define portMUX_INITIALIZER_UNLOCKED SPINLOCK_INITIALIZER -#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() -void vPortAssertIfInISR(void); - #define portCRITICAL_NESTING_IN_TCB 0 static inline void __attribute__((always_inline)) vPortCPUInitializeMutex(portMUX_TYPE *mux) @@ -213,6 +206,9 @@ static inline void __attribute__((always_inline)) vPortCPUReleaseMutex(portMUX_T void vPortEnterCritical(portMUX_TYPE *mux); void vPortExitCritical(portMUX_TYPE *mux); +#define portASSERT_IF_IN_ISR() vPortAssertIfInISR() +void vPortAssertIfInISR(void); + /* * Returns true if the current core is in ISR context; low prio ISR, med prio ISR or timer tick ISR. High prio ISRs * aren't detected here, but they normally cannot call C code, so that should not be an issue anyway. @@ -319,7 +315,7 @@ static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { -#if defined(CONFIG_ESP32_SPIRAM_SUPPORT) || defined(ESP32S2_SPIRAM_SUPPORT) +#ifdef CONFIG_SPIRAM compare_and_set_extram(addr, compare, set); #endif } @@ -478,8 +474,8 @@ BaseType_t xPortInterruptedFromISRContext(void); * contained in xRegions. */ #if( portUSING_MPU_WRAPPERS == 1 ) - //struct xMEMORY_REGION; - //void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; + struct xMEMORY_REGION; + void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t usStackDepth ) PRIVILEGED_FUNCTION; void vPortReleaseTaskMPUSettings( xMPU_SETTINGS *xMPUSettings ); #endif diff --git a/components/freertos/xtensa/xtensa_vectors.S b/components/freertos/xtensa/xtensa_vectors.S index fb94022866..b7ddedbad1 100644 --- a/components/freertos/xtensa/xtensa_vectors.S +++ b/components/freertos/xtensa/xtensa_vectors.S @@ -361,91 +361,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .endm -/* --------------------------------------------------------------------------------- - Panic handler. - Should be reached by call0 (preferable) or jump only. If call0, a0 says where - from. If on simulator, display panic message and abort, else loop indefinitely. --------------------------------------------------------------------------------- -*/ - - .section .iram1,"ax" - .global panicHandler - - .global _xt_panic - .type _xt_panic,@function - .align 4 - .literal_position - .align 4 - -_xt_panic: - /* Allocate exception frame and save minimal context. */ - mov a0, sp - addi sp, sp, -XT_STK_FRMSZ - s32i a0, sp, XT_STK_A1 - #if XCHAL_HAVE_WINDOWED - s32e a0, sp, -12 /* for debug backtrace */ - #endif - rsr a0, PS /* save interruptee's PS */ - s32i a0, sp, XT_STK_PS - rsr a0, EPC_1 /* save interruptee's PC */ - s32i a0, sp, XT_STK_PC - #if XCHAL_HAVE_WINDOWED - s32e a0, sp, -16 /* for debug backtrace */ - #endif - s32i a12, sp, XT_STK_A12 /* _xt_context_save requires A12- */ - s32i a13, sp, XT_STK_A13 /* A13 to have already been saved */ - call0 _xt_context_save - - /* Save exc cause and vaddr into exception frame */ - rsr a0, EXCCAUSE - s32i a0, sp, XT_STK_EXCCAUSE - rsr a0, EXCVADDR - s32i a0, sp, XT_STK_EXCVADDR - - /* _xt_context_save seems to save the current a0, but we need the interuptees a0. Fix this. */ - rsr a0, EXCSAVE_1 /* save interruptee's a0 */ - - s32i a0, sp, XT_STK_A0 - - /* Set up PS for C, disable all interrupts except NMI and debug, and clear EXCM. */ - movi a0, PS_INTLEVEL(5) | PS_UM | PS_WOE - wsr a0, PS - - //Call panic handler - mov a6,sp - call4 panicHandler - - - .align 4 -//Call using call0. Prints the hex char in a2. Kills a3, a4, a5 -panic_print_hex: - movi a3,0x60000000 - movi a4,8 -panic_print_hex_loop: - l32i a5, a3, 0x1c - extui a5, a5, 16, 8 - bgei a5,64,panic_print_hex_loop - - srli a5,a2,28 - bgei a5,10,panic_print_hex_a - addi a5,a5,'0' - j panic_print_hex_ok -panic_print_hex_a: - addi a5,a5,'A'-10 -panic_print_hex_ok: - s32i a5,a3,0 - slli a2,a2,4 - - addi a4,a4,-1 - bnei a4,0,panic_print_hex_loop - movi a5,' ' - s32i a5,a3,0 - - ret - - - .section .rodata, "a" .align 4 diff --git a/components/heap/heap_caps.c b/components/heap/heap_caps.c index c0ad2325ce..b1a70bcb04 100644 --- a/components/heap/heap_caps.c +++ b/components/heap/heap_caps.c @@ -598,7 +598,7 @@ IRAM_ATTR void *heap_caps_aligned_alloc(size_t alignment, size_t size, int caps) return NULL; } -void heap_caps_aligned_free(void *ptr) +IRAM_ATTR void heap_caps_aligned_free(void *ptr) { heap_caps_free(ptr); } diff --git a/components/heap/include/esp_heap_caps.h b/components/heap/include/esp_heap_caps.h index 2fcd4c7959..13449340bc 100644 --- a/components/heap/include/esp_heap_caps.h +++ b/components/heap/include/esp_heap_caps.h @@ -124,9 +124,6 @@ void *heap_caps_aligned_alloc(size_t alignment, size_t size, int caps); * @brief Used to deallocate memory previously allocated with heap_caps_aligned_alloc * * @param ptr Pointer to the memory allocated - * @note This function is aimed to deallocate only memory allocated with - * heap_caps_aligned_alloc, memory allocated with heap_caps_malloc - * MUST not be passed to this function * @note This function is deprecated, plase consider using heap_caps_free() instead */ void __attribute__((deprecated)) heap_caps_aligned_free(void *ptr); diff --git a/components/heap/multi_heap.c b/components/heap/multi_heap.c index 0c3698c474..012a6fa49c 100644 --- a/components/heap/multi_heap.c +++ b/components/heap/multi_heap.c @@ -236,10 +236,10 @@ void *multi_heap_realloc_impl(multi_heap_handle_t heap, void *p, size_t size) } multi_heap_internal_lock(heap); - - heap->free_bytes += tlsf_block_size(p); + size_t previous_block_size = tlsf_block_size(p); void *result = tlsf_realloc(heap->heap_data, p, size); if(result) { + heap->free_bytes += previous_block_size; heap->free_bytes -= tlsf_block_size(result); if (heap->free_bytes < heap->minimum_free_bytes) { heap->minimum_free_bytes = heap->free_bytes; diff --git a/components/heap/test/test_malloc_caps.c b/components/heap/test/test_malloc_caps.c index 2e3343bd30..75b8f877c7 100644 --- a/components/heap/test/test_malloc_caps.c +++ b/components/heap/test/test_malloc_caps.c @@ -162,8 +162,6 @@ TEST_CASE("heap_caps metadata test", "[heap]") TEST_ASSERT(after.minimum_free_bytes < original.total_free_bytes); } -#ifndef CONFIG_SPIRAM - /* Small function runs from IRAM to check that malloc/free/realloc all work OK when cache is disabled... */ @@ -247,4 +245,3 @@ TEST_CASE("allocation with invalid capability should also trigger the alloc fail (void)ptr; } -#endif diff --git a/components/heap/test/test_realloc.c b/components/heap/test/test_realloc.c index 547be27550..7485b949fd 100644 --- a/components/heap/test/test_realloc.c +++ b/components/heap/test/test_realloc.c @@ -24,7 +24,7 @@ TEST_CASE("realloc shrink buffer in place", "[heap]") #endif #ifndef CONFIG_ESP32S2_MEMPROT_FEATURE -TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap][ignore]") +TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap]") { const size_t buffer_size = 64; @@ -34,7 +34,7 @@ TEST_CASE("realloc shrink buffer with EXEC CAPS", "[heap][ignore]") TEST_ASSERT(y); //y needs to fall in a compatible memory area of IRAM: - TEST_ASSERT(esp_ptr_executable(y)); + TEST_ASSERT(esp_ptr_executable(y)|| esp_ptr_in_iram(y) || esp_ptr_in_diram_iram(y)); free(y); } diff --git a/components/heap/test_multi_heap_host/test_multi_heap.cpp b/components/heap/test_multi_heap_host/test_multi_heap.cpp index c3c94042de..c75718df52 100644 --- a/components/heap/test_multi_heap_host/test_multi_heap.cpp +++ b/components/heap/test_multi_heap_host/test_multi_heap.cpp @@ -18,7 +18,7 @@ TEST_CASE("multi_heap simple allocations", "[multi_heap]") { - uint8_t small_heap[10 * 1024]; + uint8_t small_heap[4 * 1024]; multi_heap_handle_t heap = multi_heap_register(small_heap, sizeof(small_heap)); @@ -59,10 +59,10 @@ TEST_CASE("multi_heap simple allocations", "[multi_heap]") TEST_CASE("multi_heap fragmentation", "[multi_heap]") { - uint8_t small_heap[10 * 1024]; + uint8_t small_heap[4 * 1024]; multi_heap_handle_t heap = multi_heap_register(small_heap, sizeof(small_heap)); - const size_t alloc_size = 1350; + const size_t alloc_size = 128; void *p[4]; for (int i = 0; i < 4; i++) { @@ -92,7 +92,6 @@ TEST_CASE("multi_heap fragmentation", "[multi_heap]") void *big = multi_heap_malloc(heap, alloc_size * 3); //Blocks in TLSF are organized in different form, so this makes no sense - //REQUIRE( p[3] == big ); /* big should go where p[3] was freed from */ multi_heap_free(heap, big); multi_heap_free(heap, p[2]); @@ -103,7 +102,6 @@ TEST_CASE("multi_heap fragmentation", "[multi_heap]") big = multi_heap_malloc(heap, alloc_size * 2); //Blocks in TLSF are organized in different form, so this makes no sense - //REQUIRE( p[0] == big ); /* big should now go where p[0] was freed from */ multi_heap_free(heap, big); } @@ -111,7 +109,7 @@ TEST_CASE("multi_heap fragmentation", "[multi_heap]") TEST_CASE("multi_heap defrag", "[multi_heap]") { void *p[4]; - uint8_t small_heap[10 * 1024]; + uint8_t small_heap[4 * 1024]; multi_heap_info_t info, info2; multi_heap_handle_t heap = multi_heap_register(small_heap, sizeof(small_heap)); @@ -161,7 +159,7 @@ TEST_CASE("multi_heap defrag", "[multi_heap]") TEST_CASE("multi_heap defrag realloc", "[multi_heap]") { void *p[4]; - uint8_t small_heap[10 * 1024]; + uint8_t small_heap[4 * 1024]; multi_heap_info_t info, info2; multi_heap_handle_t heap = multi_heap_register(small_heap, sizeof(small_heap)); @@ -206,7 +204,7 @@ TEST_CASE("multi_heap defrag realloc", "[multi_heap]") TEST_CASE("multi_heap many random allocations", "[multi_heap]") { - uint8_t big_heap[64 * 1024]; + uint8_t big_heap[8 * 1024]; const int NUM_POINTERS = 64; printf("Running multi-allocation test...\n"); @@ -217,7 +215,7 @@ TEST_CASE("multi_heap many random allocations", "[multi_heap]") const size_t initial_free = multi_heap_free_size(heap); - const int ITERATIONS = 100000; + const int ITERATIONS = 10000; for (int i = 0; i < ITERATIONS; i++) { /* check all pointers allocated so far are valid inside big_heap */ @@ -298,7 +296,7 @@ TEST_CASE("multi_heap many random allocations", "[multi_heap]") TEST_CASE("multi_heap_get_info() function", "[multi_heap]") { - uint8_t heapdata[10 * 1024]; + uint8_t heapdata[4 * 1024]; multi_heap_handle_t heap = multi_heap_register(heapdata, sizeof(heapdata)); multi_heap_info_t before, after, freed; @@ -394,7 +392,7 @@ TEST_CASE("multi_heap minimum-size allocations", "[multi_heap]") TEST_CASE("multi_heap_realloc()", "[multi_heap]") { const uint32_t PATTERN = 0xABABDADA; - uint8_t small_heap[10 * 1024]; + uint8_t small_heap[4 * 1024]; multi_heap_handle_t heap = multi_heap_register(small_heap, sizeof(small_heap)); uint32_t *a = (uint32_t *)multi_heap_malloc(heap, 64); @@ -446,16 +444,11 @@ TEST_CASE("multi_heap_realloc()", "[multi_heap]") #endif } -//TEST_CASE("corrupt heap block", "[multi_heap]"), this -// test will crash since heap check failling will trigger -// an assert failure. - // TLSF only accepts heaps aligned to 4-byte boundary so -// unaligned test does not make sense - +// only aligned allocation tests make sense. TEST_CASE("multi_heap aligned allocations", "[multi_heap]") { - uint8_t test_heap[1024 * 1024]; + uint8_t test_heap[4 * 1024]; multi_heap_handle_t heap = multi_heap_register(test_heap, sizeof(test_heap)); uint32_t aligments = 0; // starts from alignment by 4-byte boundary size_t old_size = multi_heap_free_size(heap); @@ -466,7 +459,7 @@ TEST_CASE("multi_heap aligned allocations", "[multi_heap]") multi_heap_dump(heap); printf("*********************\n"); - for(;aligments <= 128 * 1024; aligments++) { + for(;aligments <= 256; aligments++) { //Use some stupid size value to test correct alignment even in strange //memory layout objects: diff --git a/components/newlib/heap.c b/components/newlib/heap.c index ca595ff93f..d226a39197 100644 --- a/components/newlib/heap.c +++ b/components/newlib/heap.c @@ -25,7 +25,6 @@ */ extern void *heap_caps_malloc_default( size_t size ); extern void *heap_caps_realloc_default( void *ptr, size_t size ); -extern void *heap_caps_aligned_alloc(size_t alignment, size_t size, int caps); void* malloc(size_t size) { diff --git a/components/soc/include/soc/spinlock.h b/components/soc/include/soc/spinlock.h index bf798a27fe..aace1bbf25 100644 --- a/components/soc/include/soc/spinlock.h +++ b/components/soc/include/soc/spinlock.h @@ -45,8 +45,8 @@ typedef struct { */ static inline void __attribute__((always_inline)) spinlock_initialize(spinlock_t *lock) { -#if !CONFIG_FREERTOS_UNICORE assert(lock); +#if !CONFIG_FREERTOS_UNICORE lock->owner = SPINLOCK_FREE; lock->count = 0; #endif diff --git a/components/wear_levelling/test/test_wl.c b/components/wear_levelling/test/test_wl.c index 7fd779dcdc..18d49aa1f9 100644 --- a/components/wear_levelling/test/test_wl.c +++ b/components/wear_levelling/test/test_wl.c @@ -129,7 +129,7 @@ done: vTaskDelete(NULL); } -TEST_CASE("multiple tasks can access wl handle simultaneously", "[wear_levelling] [ignore]") +TEST_CASE("multiple tasks can access wl handle simultaneously", "[wear_levelling][ignore]") { const esp_partition_t *partition = get_test_data_partition(); wl_handle_t handle; diff --git a/tools/unit-test-app/components/test_utils/ref_clock.c b/tools/unit-test-app/components/test_utils/ref_clock.c index 2450d9f7ff..d97244ec65 100644 --- a/tools/unit-test-app/components/test_utils/ref_clock.c +++ b/tools/unit-test-app/components/test_utils/ref_clock.c @@ -48,7 +48,7 @@ static void IRAM_ATTR pcnt_isr(void *arg); -static intr_handle_t s_intr_handle = NULL; +static intr_handle_t s_intr_handle; static portMUX_TYPE s_lock = portMUX_INITIALIZER_UNLOCKED; static volatile uint32_t s_milliseconds; diff --git a/tools/unit-test-app/configs/default b/tools/unit-test-app/configs/default index 105c2c5af3..28a89faba7 100644 --- a/tools/unit-test-app/configs/default +++ b/tools/unit-test-app/configs/default @@ -1,3 +1,3 @@ # This config is split between targets since different component needs to be included (esp32, esp32s2) CONFIG_IDF_TARGET="esp32" -TEST_COMPONENTS=freertos esp32 esp_ipc driver heap soc spi_flash vfs +TEST_COMPONENTS=freertos esp32 esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs