diff options
author | Simon Woertz <simon@woertz.at> | 2021-11-21 21:18:27 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-15 10:33:27 -0800 |
commit | c2df6b597a1add56345c49ca5bada625a77d563c (patch) | |
tree | 307e15b9eebf9508b4c1e8ad38fb1540d4f7f280 /Meta/Lagom/CMakeLists.txt | |
parent | 7e04160b0ba9268dd007cde70a5ad42b31d990a9 (diff) | |
download | serenity-c2df6b597a1add56345c49ca5bada625a77d563c.zip |
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.
Diffstat (limited to 'Meta/Lagom/CMakeLists.txt')
-rw-r--r-- | Meta/Lagom/CMakeLists.txt | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index c02a427a6e..174110e07d 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -204,7 +204,7 @@ function(lagom_lib library fs_name) endfunction() 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) add_executable(${name}_lagom ${source}) set_target_properties(${name}_lagom PROPERTIES OUTPUT_NAME ${name}) @@ -212,6 +212,7 @@ function(lagom_test source) add_test( NAME ${name} COMMAND ${name}_lagom + WORKING_DIRECTORY ${LAGOM_TEST_WORKING_DIRECTORY} ) endfunction() @@ -500,13 +501,11 @@ if (BUILD_LAGOM) # AK file(GLOB AK_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/AK/*.cpp") foreach(source ${AK_TEST_SOURCES}) - lagom_test(${source}) + lagom_test(${source} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/AK) endforeach() - set_tests_properties(TestJSON PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/AK) # Core - lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp) - set_tests_properties(TestLibCoreIODevice PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore) + lagom_test(../../Tests/LibCore/TestLibCoreIODevice.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibCore) # Crypto file(GLOB LIBCRYPTO_TESTS CONFIGURE_DEPENDS "../../Tests/LibCrypto/*.cpp") @@ -544,8 +543,8 @@ if (BUILD_LAGOM) # TLS file(GLOB LIBTLS_TESTS CONFIGURE_DEPENDS "../../Tests/LibTLS/*.cpp") foreach(source ${LIBTLS_TESTS}) - lagom_test(${source} LIBS LagomTLS) - set_tests_properties(TestTLSHandshake PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibTLS) + lagom_test(${source} LIBS LagomTLS + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibTLS) endforeach() # Unicode |