test(cmake): exclude test targets from build only configurations (#3821)

This commit is contained in:
some00
2022-12-21 08:31:23 +01:00
committed by GitHub
parent cc1d6c46bc
commit d33e56e951
6 changed files with 1713 additions and 10 deletions
+1
View File
@@ -25,6 +25,7 @@
--ignore-exclude-errors
--ignore-exclude-errors-x
--exclude=assets
--exclude=test_assets
--exclude=test_fonts
--exclude=../src/lv_conf_internal.h
--exclude=../src/core/lv_obj_style_gen.c
+22 -10
View File
@@ -58,13 +58,19 @@ elseif (OPTIONS_FULL_32BIT)
elseif (OPTIONS_TEST_SYSHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP} -fsanitize=address --coverage)
set (TEST_LIBS --coverage -fsanitize=address)
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
set (ENABLE_TESTS ON)
elseif (OPTIONS_TEST_DEFHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP})
set (TEST_LIBS --coverage -fsanitize=address)
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
set (ENABLE_TESTS ON)
elseif (OPTIONS_TEST_MEMORYCHECK)
# sanitizer is disabled because valgrind uses LD_PRELOAD and the
# sanitizer lib needs to load first
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP})
set (LV_CONF_BUILD_DISABLE_EXAMPLES ON)
set (ENABLE_TESTS ON)
else()
message(FATAL_ERROR "Must provide a known options value (check main.py?).")
endif()
@@ -110,7 +116,9 @@ get_filename_component(LVGL_DIR ${LVGL_TEST_DIR} DIRECTORY)
# Include lvgl project file.
include(${LVGL_DIR}/CMakeLists.txt)
target_compile_options(lvgl PUBLIC ${COMPILE_OPTIONS})
target_compile_options(lvgl_examples PUBLIC ${COMPILE_OPTIONS})
if (TARGET lvgl_examples)
target_compile_options(lvgl_examples PUBLIC ${COMPILE_OPTIONS})
endif()
set(TEST_INCLUDE_DIRS
@@ -123,9 +131,13 @@ add_library(test_common
STATIC
src/lv_test_indev.c
src/lv_test_init.c
src/test_assets/animimg001.c
src/test_assets/animimg002.c
src/test_assets/animimg003.c
src/test_assets/font_1.c
src/test_assets/font_2.c
src/test_assets/font_3.c
src/test_assets/img_caret_down.c
src/test_assets/ubuntu_font.c
unity/unity_support.c
unity/unity.c
@@ -133,13 +145,6 @@ add_library(test_common
target_include_directories(test_common PUBLIC ${TEST_INCLUDE_DIRS})
target_compile_options(test_common PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
# Some examples `#include "lvgl/lvgl.h"` - which is a path which is not
# in this source repository. If this repo is in a directory names 'lvgl'
# then we can add our parent directory to the include path.
# TODO: This is not good practice and should be fixed.
get_filename_component(LVGL_PARENT_DIR ${LVGL_DIR} DIRECTORY)
target_include_directories(lvgl_examples PUBLIC $<BUILD_INTERFACE:${LVGL_PARENT_DIR}>)
# Generate one test executable for each source file pair.
# The sources in ${CMAKE_CURRENT_BINARY_DIR} is auto-generated, the
# sources in src/test_cases is the actual test case.
@@ -147,7 +152,14 @@ find_package(Ruby REQUIRED)
set(generate_test_runner_rb
${CMAKE_CURRENT_SOURCE_DIR}/unity/generate_test_runner.rb)
set(generate_test_runner_config ${CMAKE_CURRENT_SOURCE_DIR}/config.yml)
file( GLOB TEST_CASE_FILES src/test_cases/*.c )
# disable test targets for build only tests
if (ENABLE_TESTS)
file( GLOB TEST_CASE_FILES src/test_cases/*.c )
else()
set(TEST_CASE_FILES)
endif()
foreach( test_case_fname ${TEST_CASE_FILES} )
# If test file is foo/bar/baz.c then test_name is "baz".
get_filename_component(test_name ${test_case_fname} NAME_WLE)
@@ -169,7 +181,7 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
${test_case_fname}
${test_runner_fname}
)
target_link_libraries(${test_name} test_common lvgl_examples lvgl_demos lvgl png m ${TEST_LIBS})
target_link_libraries(${test_name} test_common lvgl_demos lvgl png m ${TEST_LIBS})
target_include_directories(${test_name} PUBLIC ${TEST_INCLUDE_DIRS})
target_compile_options(${test_name} PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+58
View File
@@ -0,0 +1,58 @@
#include "../../lvgl.h"
#if LV_BUILD_EXAMPLES
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
#ifndef LV_ATTRIBUTE_IMG_IMG_CARET_DOWN
#define LV_ATTRIBUTE_IMG_IMG_CARET_DOWN
#endif
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMG_CARET_DOWN uint8_t img_caret_down_map[] = {
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
/*Pixel format: Blue: 2 bit, Green: 3 bit, Red: 3 bit, Alpha 8 bit */
0x49, 0x00, 0x49, 0x04, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x25, 0x08, 0x49, 0x08, 0x92, 0x00,
0x00, 0x00, 0x00, 0xec, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xf0, 0x00, 0x74,
0x00, 0x00, 0x00, 0x83, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xd0, 0x24, 0x27,
0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xd3, 0x24, 0x27, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x87, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xd4, 0x24, 0x27, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x87, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xd7, 0x24, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x88, 0x00, 0xff, 0x00, 0xd8, 0x24, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x03, 0x00, 0x5f, 0x24, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
#if LV_COLOR_DEPTH == 16
/*Pixel format: Blue: 5 bit, Green: 6 bit, Red: 5 bit, Alpha 8 bit*/
0x29, 0x4a, 0x00, 0x28, 0x42, 0x04, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x65, 0x29, 0x08, 0x86, 0x31, 0x08, 0x10, 0x84, 0x00,
0x21, 0x08, 0x00, 0x21, 0x08, 0xec, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xf0, 0x41, 0x08, 0x74,
0x41, 0x08, 0x00, 0x41, 0x08, 0x83, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x20, 0x00, 0xd0, 0xa2, 0x10, 0x27,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x84, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x20, 0x00, 0xd3, 0xa2, 0x10, 0x27, 0x00, 0x00, 0x00,
0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x10, 0x00, 0x41, 0x08, 0x87, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xd4, 0xa2, 0x10, 0x27, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00,
0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x82, 0x10, 0x03, 0x41, 0x08, 0x87, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x20, 0x00, 0xd7, 0xa2, 0x10, 0x28, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x62, 0x10, 0x03, 0x41, 0x08, 0x88, 0x00, 0x00, 0xff, 0x00, 0x00, 0xd8, 0x82, 0x10, 0x28, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x10, 0x03, 0x62, 0x10, 0x5f, 0x82, 0x10, 0x2c, 0x00, 0x00, 0x00, 0x61, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
#if LV_COLOR_DEPTH == 32
/*Pixel format: Blue: 8 bit, Green: 8 bit, Red: 8 bit, Alpha: 8 bit*/
0x46, 0x46, 0x46, 0x00, 0x44, 0x44, 0x44, 0x04, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x2c, 0x2c, 0x2c, 0x08, 0x31, 0x31, 0x31, 0x08, 0x82, 0x82, 0x82, 0x00,
0x06, 0x06, 0x06, 0x00, 0x06, 0x06, 0x06, 0xec, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x01, 0x01, 0x01, 0xff, 0x02, 0x02, 0x02, 0xf0, 0x0a, 0x0a, 0x0a, 0x74,
0x0a, 0x0a, 0x0a, 0x00, 0x0a, 0x0a, 0x0a, 0x83, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x03, 0x03, 0x03, 0xd0, 0x14, 0x14, 0x14, 0x27,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x84, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x03, 0x03, 0x03, 0xd3, 0x13, 0x13, 0x13, 0x27, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x13, 0x13, 0x00, 0x0a, 0x0a, 0x0a, 0x87, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x02, 0x02, 0x02, 0xd4, 0x13, 0x13, 0x13, 0x27, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0d, 0x0d, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x03, 0x09, 0x09, 0x09, 0x87, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x03, 0x03, 0x03, 0xd7, 0x13, 0x13, 0x13, 0x28, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0d, 0x0d, 0x03, 0x08, 0x08, 0x08, 0x88, 0x00, 0x00, 0x00, 0xff, 0x02, 0x02, 0x02, 0xd8, 0x12, 0x12, 0x12, 0x28, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x13, 0x13, 0x03, 0x0d, 0x0d, 0x0d, 0x5f, 0x12, 0x12, 0x12, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
#endif
};
const lv_img_dsc_t img_caret_down = {
.header.always_zero = 0,
.header.w = 13,
.header.h = 8,
.data_size = 104 * LV_IMG_PX_SIZE_ALPHA_BYTE,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = img_caret_down_map,
};
#endif /* LV_BUILD_EXAMPLES */