Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 23 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,21 @@ find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})

# libinput is required for the libinput device driver test case
find_package(Libinput REQUIRED)
find_package(Libinput OPTIONAL_COMPONENTS)
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)
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
if (ENABLE_TESTS)
Expand All @@ -274,6 +283,10 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
if (${test_name} STREQUAL "_test_template")
continue()
endif()

# gather all test cases
list(APPEND TEST_CASES ${test_name})

# Create path to auto-generated source file.
set(test_runner_fname ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_Runner.c)
# Run ruby to generate source in build directory
Expand Down Expand Up @@ -309,4 +322,11 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
COMMAND ${test_name})
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()
10 changes: 8 additions & 2 deletions tests/src/lv_test_conf_full.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,14 @@
#define LV_USE_ST7735 1
#define LV_USE_ST7789 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_FREETYPE_CACHE_SIZE 768
Expand Down