fix(test): allow to run test locally on mac (#5672)

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Neo Xu
2024-02-20 10:15:08 +08:00
committed by GitHub
parent bfb76fe596
commit 8a85a49801
2 changed files with 31 additions and 5 deletions

View File

@@ -254,12 +254,21 @@ find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS}) include_directories(${FREETYPE_INCLUDE_DIRS})
# libinput is required for the libinput device driver test case # libinput is required for the libinput device driver test case
find_package(Libinput REQUIRED) find_package(Libinput OPTIONAL_COMPONENTS)
include_directories(${LIBINPUT_INCLUDE_DIRS}) include_directories(${LIBINPUT_INCLUDE_DIRS})
# libxkbcommon is required for the libinput device driver test case if (NOT LIBINPUT_FOUND)
message("libinput is not found, defaulting to 0")
add_definitions(-DLV_USE_LIBINPUT=0)
endif()
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(xkbcommon REQUIRED xkbcommon) pkg_check_modules(xkbcommon pkg_check_modules xkbcommon)
if (NOT xkbcommon_FOUND)
message("xkbcommon is not found, defaulting to 0")
add_definitions(-DLV_LIBINPUT_XKB=0)
endif()
# disable test targets for build only tests # disable test targets for build only tests
if (ENABLE_TESTS) if (ENABLE_TESTS)
@@ -274,6 +283,10 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
if (${test_name} STREQUAL "_test_template") if (${test_name} STREQUAL "_test_template")
continue() continue()
endif() endif()
# gather all test cases
list(APPEND TEST_CASES ${test_name})
# Create path to auto-generated source file. # Create path to auto-generated source file.
set(test_runner_fname ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_Runner.c) set(test_runner_fname ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_Runner.c)
# Run ruby to generate source in build directory # Run ruby to generate source in build directory
@@ -309,4 +322,11 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
COMMAND ${test_name}) COMMAND ${test_name})
endforeach( test_case_fname ${TEST_CASE_FILES} ) endforeach( test_case_fname ${TEST_CASE_FILES} )
add_custom_target(run
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --timeout 300
WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
DEPENDS ${TEST_CASES}
USES_TERMINAL
)
endif() endif()

View File

@@ -105,8 +105,14 @@
#define LV_USE_ST7735 1 #define LV_USE_ST7735 1
#define LV_USE_ST7789 1 #define LV_USE_ST7789 1
#define LV_USE_ST7796 1 #define LV_USE_ST7796 1
#define LV_USE_LIBINPUT 1
#define LV_LIBINPUT_XKB 1 #ifndef LV_USE_LIBINPUT
#define LV_USE_LIBINPUT 1
#endif
#ifndef LV_LIBINPUT_XKB
#define LV_LIBINPUT_XKB 1
#endif
#define LV_USE_FREETYPE 1 #define LV_USE_FREETYPE 1
#define LV_FREETYPE_CACHE_SIZE 768 #define LV_FREETYPE_CACHE_SIZE 768