Blog: 2023-08-24
Jump to navigation
Jump to search
Trying to figure out how to run single test in fish
Makefile:
.PHONY: test test: build/fish $(CMAKE) --build build --target test
Tests.cmake:
# CMake being CMake, you can't just add a DEPENDS argument to add_test to make it depend on any of
# your binaries actually being built before `make test` is executed (requiring `make all` first),
# and the only dependency a test can have is on another test. So we make building fish and
# `fish_tests` prerequisites to our entire top-level `test` target.
function(add_test_target NAME)
string(REPLACE "/" "-" NAME ${NAME})
add_custom_target("test_${NAME}" COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R "^${NAME}$$"
DEPENDS fish_tests tests_buildroot_target USES_TERMINAL )
endfunction()
Aha, the -R argument.
Solution:
cmake --build build --target test_tmux-complete.fish
For a test name tmux-complete.fish.