2021-03-15 12:42:53 -05:00
|
|
|
FILE(GLOB FISH_CHECKS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/checks/*.fish)
|
|
|
|
|
foreach(CHECK ${FISH_CHECKS})
|
|
|
|
|
get_filename_component(CHECK_NAME ${CHECK} NAME)
|
2025-06-19 22:55:58 +02:00
|
|
|
add_custom_target(
|
|
|
|
|
test_${CHECK_NAME}
|
2025-06-10 16:43:01 +02:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
2025-06-19 22:55:58 +02:00
|
|
|
checks/${CHECK_NAME}
|
2025-01-12 17:44:31 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
2026-01-21 16:29:22 +01:00
|
|
|
DEPENDS fish fish_indent fish_key_reader
|
2025-06-19 22:55:58 +02:00
|
|
|
USES_TERMINAL
|
2021-03-15 12:42:53 -05:00
|
|
|
)
|
|
|
|
|
endforeach(CHECK)
|
2021-03-18 13:23:31 -05:00
|
|
|
|
|
|
|
|
FILE(GLOB PEXPECTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/pexpects/*.py)
|
|
|
|
|
foreach(PEXPECT ${PEXPECTS})
|
|
|
|
|
get_filename_component(PEXPECT ${PEXPECT} NAME)
|
2025-06-19 22:55:58 +02:00
|
|
|
add_custom_target(
|
|
|
|
|
test_${PEXPECT}
|
2025-06-10 16:43:01 +02:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
2025-01-11 21:13:19 +01:00
|
|
|
pexpects/${PEXPECT}
|
2025-01-12 17:44:31 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
2026-01-21 16:29:22 +01:00
|
|
|
DEPENDS fish fish_indent fish_key_reader
|
2025-06-19 22:55:58 +02:00
|
|
|
USES_TERMINAL
|
2021-03-18 13:23:31 -05:00
|
|
|
)
|
|
|
|
|
endforeach(PEXPECT)
|
2023-01-14 14:56:24 -08:00
|
|
|
|
|
|
|
|
# Rust stuff.
|
2025-06-19 22:55:58 +02:00
|
|
|
set(cargo_test_flags)
|
2023-03-06 18:15:36 -06:00
|
|
|
if(DEFINED ASAN)
|
|
|
|
|
# Rust w/ -Zsanitizer=address requires explicitly specifying the --target triple or else linker
|
|
|
|
|
# errors pertaining to asan symbols will ensue.
|
|
|
|
|
if(NOT DEFINED Rust_CARGO_TARGET)
|
|
|
|
|
message(FATAL_ERROR "ASAN requires defining the CMake variable Rust_CARGO_TARGET to the
|
|
|
|
|
intended target triple")
|
|
|
|
|
endif()
|
2024-06-21 11:56:50 -05:00
|
|
|
endif()
|
2024-08-04 10:18:06 +02:00
|
|
|
if(DEFINED TSAN)
|
|
|
|
|
if(NOT DEFINED Rust_CARGO_TARGET)
|
|
|
|
|
message(FATAL_ERROR "TSAN requires defining the CMake variable Rust_CARGO_TARGET to the
|
|
|
|
|
intended target triple")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2024-06-21 11:56:50 -05:00
|
|
|
|
|
|
|
|
if(DEFINED Rust_CARGO_TARGET)
|
2024-01-13 01:26:28 +01:00
|
|
|
list(APPEND cargo_test_flags "--target" ${Rust_CARGO_TARGET})
|
|
|
|
|
list(APPEND cargo_test_flags "--lib")
|
2023-03-06 18:15:36 -06:00
|
|
|
endif()
|
|
|
|
|
|
2025-06-19 22:55:58 +02:00
|
|
|
set(max_concurrency_flag)
|
|
|
|
|
if(DEFINED ENV{FISH_TEST_MAX_CONCURRENCY})
|
|
|
|
|
list(APPEND max_concurrency_flag "--max-concurrency" $ENV{FISH_TEST_MAX_CONCURRENCY})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# The top-level test target is "fish_run_tests".
|
|
|
|
|
add_custom_target(fish_run_tests
|
|
|
|
|
# TODO: This should be replaced with a unified solution, possibly build_tools/check.sh.
|
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${max_concurrency_flag} ${CMAKE_CURRENT_BINARY_DIR}
|
2025-12-09 19:29:23 +01:00
|
|
|
COMMAND env ${VARS_FOR_CARGO}
|
|
|
|
|
${Rust_CARGO}
|
|
|
|
|
test
|
|
|
|
|
--no-default-features
|
2025-12-09 19:29:23 +01:00
|
|
|
--features=${FISH_CARGO_FEATURES}
|
2025-12-09 19:29:23 +01:00
|
|
|
${CARGO_FLAGS}
|
|
|
|
|
--workspace
|
|
|
|
|
--target-dir ${rust_target_dir}
|
|
|
|
|
${cargo_test_flags}
|
2025-06-19 22:55:58 +02:00
|
|
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
2026-01-21 16:29:22 +01:00
|
|
|
DEPENDS fish fish_indent fish_key_reader
|
2025-06-19 22:55:58 +02:00
|
|
|
USES_TERMINAL
|
2024-01-07 21:38:49 +01:00
|
|
|
)
|