git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Phillip Wood <phillip.wood123@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v3 0/7] CMake(Visual C) support for js/doc-unit-tests
Date: Mon, 25 Sep 2023 11:20:29 +0000	[thread overview]
Message-ID: <pull.1579.v3.git.1695640836.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1579.v2.git.1695070468.gitgitgadget@gmail.com>

The recent patch series that adds proper unit testing to Git requires a
couple of add-on patches to make it work with the CMake build on Windows
(Visual C). This patch series aims to provide that support.

This patch series is based on js/doc-unit-tests.

Changes since v2:

 * Thanks to Phillip Wood's prodding, I managed to avoid the "Empty
   Namespace" problem in Visual Studio's Test Explorer.

Changes since v1:

 * The code added to test-lib.c now avoids using a strbuf.
 * The unit tests are now also handled via CTest.
 * While at it, I cleaned up a little in the CTest-related definitions.

Johannes Schindelin (7):
  cmake: also build unit tests
  unit-tests: do not mistake `.pdb` files for being executable
  unit-tests: do show relative file paths
  artifacts-tar: when including `.dll` files, don't forget the
    unit-tests
  cmake: fix typo in variable name
  cmake: use test names instead of full paths
  cmake: handle also unit tests

 Makefile                            |  2 +-
 contrib/buildsystems/CMakeLists.txt | 38 ++++++++++++++++++---
 t/Makefile                          |  2 +-
 t/unit-tests/test-lib.c             | 52 ++++++++++++++++++++++++++---
 4 files changed, 84 insertions(+), 10 deletions(-)


base-commit: 03f9bc407975bba86d1d1807519d76e1693ff66f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1579%2Fdscho%2Fdoc-unit-tests-and-cmake-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1579/dscho/doc-unit-tests-and-cmake-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1579

Range-diff vs v2:

 1:  2cc1c03d851 = 1:  2cc1c03d851 cmake: also build unit tests
 2:  90db3d5d41f = 2:  90db3d5d41f unit-tests: do not mistake `.pdb` files for being executable
 3:  f0b804129e8 = 3:  f0b804129e8 unit-tests: do show relative file paths
 4:  a70339f57a7 = 4:  a70339f57a7 artifacts-tar: when including `.dll` files, don't forget the unit-tests
 5:  75a74571fbe = 5:  75a74571fbe cmake: fix typo in variable name
 6:  41228df1b46 ! 6:  0a2d08b91e5 cmake: use test names instead of full paths
     @@ Commit message
          dots confuse the Test Explorer and it uses a large part of the path as
          "namespace".
      
     -    Let's just use `t.<name>` instead. This still adds an ugly "Empty
     -    Namespace" layer by default, but at least the ugly absolute path is now
     -    gone.
     +    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 <johannes.schindelin@gmx.de>
      
     @@ contrib/buildsystems/CMakeLists.txt: file(GLOB test_scripts "${CMAKE_SOURCE_DIR}
       foreach(tsh ${test_scripts})
      -	add_test(NAME ${tsh}
      +	string(REGEX REPLACE ".*/(.*)\\.sh" "\\1" test_name ${tsh})
     -+	add_test(NAME "t.${test_name}"
     ++	add_test(NAME "t.suite.${test_name}"
       		COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
       		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
       endforeach()
     @@ contrib/buildsystems/CMakeLists.txt: file(GLOB test_scripts "${CMAKE_SOURCE_DIR}
       # This test script takes an extremely long time and is known to time out even
       # on fast machines because it requires in excess of one hour to run
      -set_tests_properties("${CMAKE_SOURCE_DIR}/t/t7112-reset-submodule.sh" PROPERTIES TIMEOUT 4000)
     -+set_tests_properties("t.t7112-reset-submodule" PROPERTIES TIMEOUT 4000)
     ++set_tests_properties("t.suite.t7112-reset-submodule" PROPERTIES TIMEOUT 4000)
       
       endif()#BUILD_TESTING
 7:  003d44e9f0d ! 7:  64707240a4e cmake: handle also unit tests
     @@ contrib/buildsystems/CMakeLists.txt: foreach(unit_test ${unit_test_PROGRAMS})
      +	#
      +	# All other unit tests should be run.
      +	if(NOT ${unit_test} STREQUAL "t-basic")
     -+		add_test(NAME "unit-tests.${unit_test}"
     ++		add_test(NAME "t.unit-tests.${unit_test}"
      +			COMMAND "./${unit_test}"
      +			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t/unit-tests)
      +	endif()

-- 
gitgitgadget

  parent reply	other threads:[~2023-09-25 11:20 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
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   ` Johannes Schindelin via GitGitGadget [this message]
2023-09-25 11:20     ` [PATCH v3 1/7] cmake: also build " 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=pull.1579.v3.git.1695640836.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood123@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).