mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
add test cmake
This commit is contained in:
parent
f06f7e21c9
commit
273ce0c186
@ -64,6 +64,11 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(PK_IS_MAIN TRUE)
|
||||
option(PK_BUILD_SHARED_LIB "Build shared library" OFF)
|
||||
option(PK_BUILD_STATIC_LIB "Build static library" OFF)
|
||||
|
||||
include(CTest)
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(tests/)
|
||||
endif()
|
||||
else()
|
||||
set(PK_IS_MAIN FALSE)
|
||||
option(PK_BUILD_SHARED_LIB "Build shared library" OFF)
|
||||
|
17
tests/CMakeLists.txt
Normal file
17
tests/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
function(pkpy_add_test pyfile)
|
||||
get_filename_component(test_name ${pyfile} NAME_WE)
|
||||
add_test(
|
||||
NAME ${test_name}
|
||||
COMMAND $<TARGET_FILE:main> ${pyfile}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
|
||||
)
|
||||
message("Added test " ${test_name})
|
||||
endfunction()
|
||||
|
||||
file(GLOB PK_PYTHON_TESTCASES_FILES RELATIVE ${CMAKE_CURRENT_LIST_DIR}/.. "*.py")
|
||||
|
||||
foreach(pyfile ${PK_PYTHON_TESTCASES_FILES})
|
||||
pkpy_add_test(${pyfile})
|
||||
endforeach()
|
Loading…
x
Reference in New Issue
Block a user