]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cmake: handle also unit tests
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 25 Sep 2023 11:20:36 +0000 (11:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Nov 2023 23:16:27 +0000 (08:16 +0900)
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>
contrib/buildsystems/CMakeLists.txt

index 356f068cacd0f3a4ef174a44029098572a36567d..671c7ead75381dfb0ef84a97091404b18e388ff5 100644 (file)
@@ -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