test add support for using system heap
This commit is contained in:
@@ -177,9 +177,9 @@ set(LVGL_TEST_OPTIONS_FULL_32BIT
|
||||
-DLV_USE_SJPG=1
|
||||
-DLV_USE_GIF=1
|
||||
-DLV_USE_QRCODE=1
|
||||
)
|
||||
)
|
||||
|
||||
set(LVGL_TEST_OPTIONS_TEST
|
||||
set(LVGL_TEST_OPTIONS_TEST_COMMON
|
||||
--coverage
|
||||
-DLV_COLOR_DEPTH=32
|
||||
-DLV_MEM_SIZE=2097152
|
||||
@@ -214,6 +214,20 @@ set(LVGL_TEST_OPTIONS_FULL_32BIT
|
||||
-DLV_LABEL_TEXT_SELECTION=1
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
|
||||
-Wno-unused-but-set-variable # unused variables are common in the dual-heap arrangement
|
||||
)
|
||||
|
||||
set(LVGL_TEST_OPTIONS_TEST_SYSHEAP
|
||||
${LVGL_TEST_OPTIONS_TEST_COMMON}
|
||||
-DLVGL_CI_USING_SYS_HEAP
|
||||
-DLV_MEM_CUSTOM=1
|
||||
-fsanitize=address
|
||||
)
|
||||
|
||||
set(LVGL_TEST_OPTIONS_TEST_DEFHEAP
|
||||
${LVGL_TEST_OPTIONS_TEST_COMMON}
|
||||
-DLVGL_CI_USING_DEF_HEAP
|
||||
-DLV_MEM_SIZE=2097152
|
||||
)
|
||||
|
||||
if (OPTIONS_MINIMAL_MONOCHROME)
|
||||
@@ -226,11 +240,14 @@ elseif (OPTIONS_16BIT_SWAP)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_16BIT_SWAP})
|
||||
elseif (OPTIONS_FULL_32BIT)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_FULL_32BIT})
|
||||
elseif (OPTIONS_TEST)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST})
|
||||
elseif (OPTIONS_TEST_SYSHEAP)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP})
|
||||
set (TEST_LIBS --coverage -fsanitize=address)
|
||||
elseif (OPTIONS_TEST_DEFHEAP)
|
||||
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP})
|
||||
set (TEST_LIBS --coverage)
|
||||
else()
|
||||
message(FATAL_ERROR "Must provide an options value.")
|
||||
message(FATAL_ERROR "Must provide a known options value (check main.py?).")
|
||||
endif()
|
||||
|
||||
# Options lvgl and examples are compiled with.
|
||||
|
||||
@@ -20,7 +20,8 @@ build_only_options = {
|
||||
}
|
||||
|
||||
test_options = {
|
||||
'OPTIONS_TEST': 'Test config, 32 bit color depth',
|
||||
'OPTIONS_TEST_DEFHEAP': 'Test config, LVGL heap, 32 bit color depth',
|
||||
'OPTIONS_TEST_SYSHEAP': 'Test config, system heap, 32 bit color depth',
|
||||
}
|
||||
|
||||
|
||||
|
||||
13
tests/src/lv_test_helpers.h
Normal file
13
tests/src/lv_test_helpers.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef LV_TEST_HELPERS_H
|
||||
#define LV_TEST_HELPERS_H
|
||||
|
||||
#ifdef LVGL_CI_USING_SYS_HEAP
|
||||
/* Skip checking heap as we don't have the info available */
|
||||
#define LV_HEAP_CHECK(x) do {} while(0)
|
||||
#else
|
||||
#define LV_HEAP_CHECK(x) x
|
||||
#endif /* LVGL_CI_USING_SYS_HEAP */
|
||||
|
||||
#endif /*LV_TEST_HELPERS_H*/
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#include "lv_test_helpers.h"
|
||||
#include "lv_test_indev.h"
|
||||
|
||||
void test_checkbox_creation_successfull(void);
|
||||
@@ -89,7 +90,7 @@ void test_checkbox_should_allocate_memory_for_static_text(void)
|
||||
|
||||
lv_mem_monitor(&m1);
|
||||
|
||||
TEST_ASSERT_LESS_THAN(initial_available_memory, m1.free_size);
|
||||
LV_HEAP_CHECK(TEST_ASSERT_LESS_THAN(initial_available_memory, m1.free_size));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#include "lv_test_helpers.h"
|
||||
#include "lv_test_indev.h"
|
||||
|
||||
#define SWITCHES_CNT 10
|
||||
@@ -67,7 +68,7 @@ void test_switch_should_not_leak_memory_after_deletion(void)
|
||||
lv_mem_monitor(&monitor);
|
||||
final_available_memory = monitor.free_size;
|
||||
|
||||
TEST_ASSERT_LESS_THAN(initial_available_memory, final_available_memory);
|
||||
LV_HEAP_CHECK(TEST_ASSERT_LESS_THAN(initial_available_memory, final_available_memory));
|
||||
}
|
||||
|
||||
void test_switch_animation(void)
|
||||
|
||||
@@ -230,6 +230,8 @@ static void png_release(png_img_t * p)
|
||||
for (y=0; y<p->height; y++) free(p->row_pointers[y]);
|
||||
|
||||
free(p->row_pointers);
|
||||
|
||||
png_destroy_read_struct(&p->png_ptr, &p->info_ptr, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user