{"thread":{"id":"60929","subject":"[PATCH] cmake: let `test-tool` run the unit tests, too","startedAt":"2024-02-15T23:15:27Z","lastAt":"2024-02-15T23:45:56Z","messageCount":2,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"488768","messageId":"pull.1666.git.1708038924522.gitgitgadget@gmail.com","threadId":"60929","inReplyTo":null,"subject":"[PATCH] cmake: let `test-tool` run the unit tests, too","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-02-15T23:15:24Z","receivedAt":"2024-02-15T23:15:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe `test-tool` recently learned to run the unit tests. To this end, it\nneeds to link with `test-lib.c`, which was done in the `Makefile`, and\nthis patch does it in the CMake definition, too.\n\nThis is a companion of 44400f58407e (t0080: turn t-basic unit test into\na helper, 2024-02-02).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    cmake: let test-tool run the unit tests, too\n    \n    The test-tool recently learned to run the unit tests. To this end, it\n    needs to link with test-lib.c, which was done in the Makefile, and this\n    patch does it in the CMake definition, too.\n    \n    This is a companion of 44400f58407e (t0080: turn t-basic unit test into\n    a helper, 2024-02-02), and is based on js/unit-test-suite-runner.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1666%2Fgit-for-windows%2Fjs%2Funit-test-suite-runner-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1666/git-for-windows/js/unit-test-suite-runner-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1666\n\n contrib/buildsystems/CMakeLists.txt | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt\nindex 804629c525b..2f9c33585c6 100644\n--- a/contrib/buildsystems/CMakeLists.txt\n+++ b/contrib/buildsystems/CMakeLists.txt\n@@ -1005,10 +1005,11 @@ endforeach()\n \n #test-tool\n parse_makefile_for_sources(test-tool_SOURCES \"TEST_BUILTINS_OBJS\")\n+add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)\n \n list(TRANSFORM test-tool_SOURCES PREPEND \"${CMAKE_SOURCE_DIR}/t/helper/\")\n add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})\n-target_link_libraries(test-tool common-main)\n+target_link_libraries(test-tool test-lib common-main)\n \n set_target_properties(test-fake-ssh test-tool\n \t\t\tPROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/helper)\n\nbase-commit: b3b269c2d8931642c4b9f03b9ce9e81c20995eb8\n-- \ngitgitgadget\n"},{"id":"488772","messageId":"xmqq5xypmgup.fsf@gitster.g","threadId":"60929","inReplyTo":"pull.1666.git.1708038924522.gitgitgadget@gmail.com","subject":"Re: [PATCH] cmake: let `test-tool` run the unit tests, too","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-02-15T23:45:50Z","receivedAt":"2024-02-15T23:45:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> The `test-tool` recently learned to run the unit tests. To this end, it\n> needs to link with `test-lib.c`, which was done in the `Makefile`, and\n> this patch does it in the CMake definition, too.\n\nNice.  Will queue.  Thanks.\n\n> +add_library(test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)\n>  \n>  list(TRANSFORM test-tool_SOURCES PREPEND \"${CMAKE_SOURCE_DIR}/t/helper/\")\n>  add_executable(test-tool ${CMAKE_SOURCE_DIR}/t/helper/test-tool.c ${test-tool_SOURCES} ${test-reftable_SOURCES})\n> -target_link_libraries(test-tool common-main)\n> +target_link_libraries(test-tool test-lib common-main)\n"}]}