Skip to content

Commit 694e89b

Browse files
dschogitster
authored andcommitted
cmake: handle also unit tests
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 <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2f2729f commit 694e89b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,17 @@ foreach(unit_test ${unit_test_PROGRAMS})
981981
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests/bin)
982982
endif()
983983
list(APPEND PROGRAMS_BUILT "${unit_test}")
984+
985+
# t-basic intentionally fails tests, to validate the unit-test infrastructure.
986+
# Therefore, it should only be run as part of t0080, which verifies that it
987+
# fails only in the expected ways.
988+
#
989+
# All other unit tests should be run.
990+
if(NOT ${unit_test} STREQUAL "t-basic")
991+
add_test(NAME "t.unit-tests.${unit_test}"
992+
COMMAND "./${unit_test}"
993+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests/bin)
994+
endif()
984995
endforeach()
985996

986997
#test-tool

0 commit comments

Comments
 (0)