Skip to content

Commit 2f2729f

Browse files
dschogitster
authored andcommitted
cmake: use test names instead of full paths
The primary purpose of Git's CMake definition is to allow developing Git in Visual Studio. As part of that, the CTest feature allows running individual test scripts conveniently in Visual Studio's Test Explorer. However, this Test Explorer's design targets object-oriented languages and therefore expects the test names in the form `<namespace>.<class>.<testname>`. And since we specify the full path of the test scripts instead, including the ugly `/.././t/` part, these dots confuse the Test Explorer and it uses a large part of the path as "namespace". Let's just use `t.suite.<name>` instead. This presents the tests in Visual Studio's Test Explorer in the following form by default (i.e. unless the user changes the view via the "Group by" menu): ◢ ◈ git ◢ ◈ t ◢ ◈ suite ◈ t0000-basic ◈ t0001-init ◈ t0002-gitfile [...] Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5bd7fb4 commit 2f2729f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,13 +1106,14 @@ file(GLOB test_scripts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
11061106

11071107
#test
11081108
foreach(tsh ${test_scripts})
1109-
add_test(NAME ${tsh}
1109+
string(REGEX REPLACE ".*/(.*)\\.sh" "\\1" test_name ${tsh})
1110+
add_test(NAME "t.suite.${test_name}"
11101111
COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
11111112
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
11121113
endforeach()
11131114

11141115
# This test script takes an extremely long time and is known to time out even
11151116
# on fast machines because it requires in excess of one hour to run
1116-
set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000)
1117+
set_tests_properties("t.suite.t7112-reset-submodule" PROPERTIES TIMEOUT 4000)
11171118

11181119
endif()#BUILD_TESTING

0 commit comments

Comments
 (0)