1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 07:57:46 +00:00

Meta: Allow running Lagom tests with "serenity.sh run lagom <target>"

After 5ac57f9, we could no longer run "serenity.sh run lagom TestString"
because the TestString binary now lives in a subdirectory under
Build/lagom. Thus the existing method of running "$BUILD_DIR/TestString"
could not work.

This adds a "run-lagom-target" custom target to Lagom, to run a command
and pass arguments to that invocation. It turns out there really isn't a
"pretty" way of doing this with CMake or Ninja. But we can pass these as
environment variables for CMake to interpret. We just must be careful to
massage arguments into a CMake list.
This commit is contained in:
Timothy Flynn 2023-01-25 14:46:44 -05:00 committed by Tim Flynn
parent a5db4a0551
commit 9743445e44
2 changed files with 28 additions and 2 deletions

View file

@ -688,3 +688,12 @@ if (ENABLE_FUZZERS)
else()
export_components("${CMAKE_BINARY_DIR}/components.ini")
endif()
if (NOT "$ENV{LAGOM_TARGET}" STREQUAL "")
add_custom_target(run-lagom-target
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SERENITY_PROJECT_ROOT}" "$<TARGET_FILE:$ENV{LAGOM_TARGET}>" $ENV{LAGOM_ARGS}
DEPENDS "$<TARGET_FILE:$ENV{LAGOM_TARGET}>"
USES_TERMINAL
VERBATIM
)
endif()