mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
Lagom: Add argument WORKING_DIRECTORY
to lagom_test(...)
So far the working directory was set in some cases using `set_tests_properties(...)`, but this requires to know which name is picked by `lagom_test(...)` when calling `add_test(...)`. In case of adding multiple test cases using a globbing pattern this would require to duplicate code to construct the test name from the file name.
This commit is contained in:
parent
7e04160b0b
commit
c2df6b597a
1 changed files with 6 additions and 7 deletions
|
@ -204,7 +204,7 @@ function(lagom_lib library fs_name)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(lagom_test source)
|
function(lagom_test source)
|
||||||
cmake_parse_arguments(LAGOM_TEST "" "" "LIBS" ${ARGN})
|
cmake_parse_arguments(LAGOM_TEST "" "WORKING_DIRECTORY" "LIBS" ${ARGN})
|
||||||
get_filename_component(name ${source} NAME_WE)
|
get_filename_component(name ${source} NAME_WE)
|
||||||
add_executable(${name}_lagom ${source})
|
add_executable(${name}_lagom ${source})
|
||||||
set_target_properties(${name}_lagom PROPERTIES OUTPUT_NAME ${name})
|
set_target_properties(${name}_lagom PROPERTIES OUTPUT_NAME ${name})
|
||||||
|
@ -212,6 +212,7 @@ function(lagom_test source)
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${name}
|
NAME ${name}
|
||||||
COMMAND ${name}_lagom
|
COMMAND ${name}_lagom
|
||||||
|
WORKING_DIRECTORY ${LAGOM_TEST_WORKING_DIRECTORY}
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -500,13 +501,11 @@ if (BUILD_LAGOM)
|
||||||
# AK
|
# AK
|
||||||
file(GLOB AK_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/AK/*.cpp")
|
file(GLOB AK_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/AK/*.cpp")
|
||||||
foreach(source ${AK_TEST_SOURCES})
|
foreach(source ${AK_TEST_SOURCES})
|
||||||
lagom_test(${source})
|
lagom_test(${source} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/AK)
|
||||||
endforeach()
|
endforeach()
|
||||||
set_tests_properties(TestJSON PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/AK)
|
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp)
|
lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore)
|
||||||
set_tests_properties(TestLibCoreIODevice PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore)
|
|
||||||
|
|
||||||
# Crypto
|
# Crypto
|
||||||
file(GLOB LIBCRYPTO_TESTS CONFIGURE_DEPENDS "../../Tests/LibCrypto/*.cpp")
|
file(GLOB LIBCRYPTO_TESTS CONFIGURE_DEPENDS "../../Tests/LibCrypto/*.cpp")
|
||||||
|
@ -544,8 +543,8 @@ if (BUILD_LAGOM)
|
||||||
# TLS
|
# TLS
|
||||||
file(GLOB LIBTLS_TESTS CONFIGURE_DEPENDS "../../Tests/LibTLS/*.cpp")
|
file(GLOB LIBTLS_TESTS CONFIGURE_DEPENDS "../../Tests/LibTLS/*.cpp")
|
||||||
foreach(source ${LIBTLS_TESTS})
|
foreach(source ${LIBTLS_TESTS})
|
||||||
lagom_test(${source} LIBS LagomTLS)
|
lagom_test(${source} LIBS LagomTLS
|
||||||
set_tests_properties(TestTLSHandshake PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibTLS)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibTLS)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Unicode
|
# Unicode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue