All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH 1/4] cmake: also build unit tests
Date: Mon, 11 Sep 2023 14:23:44 +0100	[thread overview]
Message-ID: <d7d1505c-8d65-4b64-8814-3e3b1e46f8ac@gmail.com> (raw)
In-Reply-To: <2cc1c03d85153356edd55fc0747a957db3c94ab0.1693462532.git.gitgitgadget@gmail.com>

Hi Johannes

On 31/08/2023 07:15, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> A new, better way to run unit tests was just added to Git. This adds
> support for building those unit tests via CMake.

This patch builds the unit tests but does not add them to the list of 
tests run by CTest - how are the tests typically run on the CMake build?

Best Wishes

Phillip

> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>   contrib/buildsystems/CMakeLists.txt | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index 2f6e0197ffa..45016213358 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -965,6 +965,24 @@ target_link_libraries(test-fake-ssh common-main)
>   parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
>   list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
>   
> +#unit-tests
> +add_library(unit-test-lib OBJECT ${CMAKE_SOURCE_DIR}/t/unit-tests/test-lib.c)
> +
> +parse_makefile_for_scripts(unit_test_PROGRAMS "UNIT_TEST_PROGRAMS" "")
> +foreach(unit_test ${unit_test_PROGRAMS})
> +	add_executable("${unit_test}" "${CMAKE_SOURCE_DIR}/t/unit-tests/${unit_test}.c")
> +	target_link_libraries("${unit_test}" unit-test-lib common-main)
> +	set_target_properties("${unit_test}"
> +		PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/t/unit-tests)
> +	if(MSVC)
> +		set_target_properties("${unit_test}"
> +			PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/unit-tests)
> +		set_target_properties("${unit_test}"
> +			PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/unit-tests)
> +	endif()
> +	list(APPEND PROGRAMS_BUILT "${unit_test}")
> +endforeach()
> +
>   #test-tool
>   parse_makefile_for_sources(test-tool_SOURCES "TEST_BUILTINS_OBJS")
>   

  reply	other threads:[~2023-09-11 21:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31  6:15 [PATCH 0/4] CMake(Visual C) support for js/doc-unit-tests Johannes Schindelin via GitGitGadget
2023-08-31  6:15 ` [PATCH 1/4] cmake: also build unit tests Johannes Schindelin via GitGitGadget
2023-09-11 13:23   ` Phillip Wood [this message]
2023-09-18 20:58     ` Johannes Schindelin
2023-08-31  6:15 ` [PATCH 2/4] unit-tests: do not mistake `.pdb` files for being executable Johannes Schindelin via GitGitGadget
2023-08-31  6:15 ` [PATCH 3/4] unit-tests: do show relative file paths Johannes Schindelin via GitGitGadget
2023-09-11 13:25   ` Phillip Wood
2023-09-18 21:00     ` Johannes Schindelin
2023-08-31  6:15 ` [PATCH 4/4] artifacts-tar: when including `.dll` files, don't forget the unit-tests Johannes Schindelin via GitGitGadget
2023-09-18 20:54 ` [PATCH v2 0/7] CMake(Visual C) support for js/doc-unit-tests Johannes Schindelin via GitGitGadget
2023-09-18 20:54   ` [PATCH v2 1/7] cmake: also build unit tests Johannes Schindelin via GitGitGadget
2023-09-18 20:54   ` [PATCH v2 2/7] unit-tests: do not mistake `.pdb` files for being executable Johannes Schindelin via GitGitGadget
2023-09-18 20:54   ` [PATCH v2 3/7] unit-tests: do show relative file paths Johannes Schindelin via GitGitGadget
2023-09-22 14:35     ` Phillip Wood
2023-09-18 20:54   ` [PATCH v2 4/7] artifacts-tar: when including `.dll` files, don't forget the unit-tests Johannes Schindelin via GitGitGadget
2023-09-18 20:54   ` [PATCH v2 5/7] cmake: fix typo in variable name Johannes Schindelin via GitGitGadget
2023-09-18 20:54   ` [PATCH v2 6/7] cmake: use test names instead of full paths Johannes Schindelin via GitGitGadget
2023-09-22 14:37     ` Phillip Wood
2023-09-25  9:06       ` Johannes Schindelin
2023-09-18 20:54   ` [PATCH v2 7/7] cmake: handle also unit tests Johannes Schindelin via GitGitGadget
2023-09-22 14:39     ` Phillip Wood
2023-09-25 11:20   ` [PATCH v3 0/7] CMake(Visual C) support for js/doc-unit-tests Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 1/7] cmake: also build unit tests Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 2/7] unit-tests: do not mistake `.pdb` files for being executable Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 3/7] unit-tests: do show relative file paths Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 4/7] artifacts-tar: when including `.dll` files, don't forget the unit-tests Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 5/7] cmake: fix typo in variable name Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 6/7] cmake: use test names instead of full paths Johannes Schindelin via GitGitGadget
2023-09-25 11:20     ` [PATCH v3 7/7] cmake: handle also unit tests Johannes Schindelin via GitGitGadget
2023-09-25 19:09     ` [PATCH v3 0/7] CMake(Visual C) support for js/doc-unit-tests Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7d1505c-8d65-4b64-8814-3e3b1e46f8ac@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.