Skip to content

Commit

Permalink
cmake: handle also unit tests
Browse files Browse the repository at this point in the history
The unit tests should also be available e.g. in Visual Studio's Test
Explorer when configuring Git's source code via CMake.

Suggested-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
dscho authored and gitster committed Nov 9, 2023
1 parent 2f2729f commit 694e89b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contrib/buildsystems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,17 @@ foreach(unit_test ${unit_test_PROGRAMS})
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
endif()
list(APPEND PROGRAMS_BUILT "${unit_test}")

# t-basic intentionally fails tests, to validate the unit-test infrastructure.
# Therefore, it should only be run as part of t0080, which verifies that it
# fails only in the expected ways.
#
# All other unit tests should be run.
if(NOT ${unit_test} STREQUAL "t-basic")
add_test(NAME "t.unit-tests.${unit_test}"
COMMAND "./${unit_test}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests/bin)
endif()
endforeach()

#test-tool
Expand Down

0 comments on commit 694e89b

Please sign in to comment.