mbox series

[v3,00/12] cmake: document, fix on *nix, add CI

Message ID cover-v3-00.12-00000000000-20221101T225022Z-avarab@gmail.com (mailing list archive)
Headers show
Series cmake: document, fix on *nix, add CI | expand

Message

Ævar Arnfjörð Bjarmason Nov. 1, 2022, 10:51 p.m. UTC
This topic gets our tests from passing ~80% with ctest on *nix to
passing 100%. Now on top of master, as js/cmake-updates landed.

See passing CI job for "cmake + ctest" on Ubuntu at:
https://github.com/avar/git/actions/runs/3370930115/jobs/5593431733

Changes since the v2:

 * Documentation rewording/updates/grammar fixes, thanks to Eric
   Sunshine.

 * A whitespace nit for set_property(), I wasn't using the indenting
   style that's prevalent in the CMakeLists.txt (not our usual "align
   the argument list" tab-indent).

 * Added a Windows ifdef around the recent timeout increase for a
   single submodule test (not an issue on *nix).

Ævar Arnfjörð Bjarmason (12):
  cmake: don't "mkdir -p" and "cd" in build instructions
  cmake: update instructions for portable CMakeLists.txt
  cmake: don't copy chainlint.pl to build directory
  cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4
  cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable
  cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh
  test-lib.sh: support a "GIT_TEST_BUILD_DIR"
  Makefile + cmake: use environment, not GIT-BUILD-DIR
  cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults
  cmake: increase test timeout on Windows only
  cmake: copy over git-p4.py for t983[56] perforce test
  CI: add a "linux-cmake-test" to run cmake & ctest on linux

 .github/workflows/main.yml          |   3 +
 .gitignore                          |   1 -
 Makefile                            |   1 -
 ci/run-build-and-tests.sh           |  13 ++-
 contrib/buildsystems/CMakeLists.txt | 141 +++++++++++++++++++++-------
 t/README                            |   3 +
 t/lib-gettext.sh                    |   2 +-
 t/lib-gitweb.sh                     |   2 +-
 t/t7609-mergetool--lib.sh           |   2 +-
 t/t9902-completion.sh               |  14 +--
 t/t9903-bash-prompt.sh              |   2 +-
 t/test-lib.sh                       |  27 +++++-
 12 files changed, 157 insertions(+), 54 deletions(-)

Range-diff against v2:
 1:  667a2bd5271 =  1:  028fa1436d8 cmake: don't "mkdir -p" and "cd" in build instructions
 2:  9e2470dcb95 !  2:  7a21f4aa24c cmake: update instructions for portable CMakeLists.txt
    @@ contrib/buildsystems/CMakeLists.txt
     +
     +== Building ==
     +
    -+One the recipe is created a build recipe will be created. For Windows
    -+Open contrib/buildsystems/git.sln on Windows and build Git. Or use the
    ++The "cmake" command creates a build file from this recipe. For Windows
    ++Open contrib/buildsystems/git.sln and build Git. Or use the
     +"msbuild" command-line tool (see our own ".github/workflows/main.yml"
     +for a real example):
     +
     +	msbuild git.sln
     +
    -+On all other platforms running "cmake" will generate a Makefile, to
    ++On all other platforms running "cmake" will generate a Makefile; to
     +build with it run:
     +
     +	make -C contrib/buildsystems/out
 3:  2d7d9742a73 =  3:  3bfa873e792 cmake: don't copy chainlint.pl to build directory
 4:  ea8a3feec81 =  4:  ad551f53de9 cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4
 5:  6387682db06 =  5:  5c7b64286ce cmake & test-lib.sh: add a $GIT_SOURCE_DIR variable
 6:  29a9811857f =  6:  cba90650879 cmake: set "USE_LIBPCRE2" in "GIT-BUILD-OPTIONS" for test-lib.sh
 7:  a9ea3867f5f =  7:  bd7fb1eec24 test-lib.sh: support a "GIT_TEST_BUILD_DIR"
 8:  51bb01b99d4 !  8:  fd3e6be5689 Makefile + cmake: use environment, not GIT-BUILD-DIR
    @@ contrib/buildsystems/CMakeLists.txt: foreach(tsh ${test_scipts})
      	add_test(NAME ${tsh}
      		COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
      		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
    -+       set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT
    -+		    GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR})		
    ++	set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT
    ++		GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR})
      endforeach()
      
      # This test script takes an extremely long time and is known to time out even
 9:  9f5276d79c9 !  9:  8a660a2baa4 cmake: support GIT_TEST_OPTS, abstract away WIN32 defaults
    @@ contrib/buildsystems/CMakeLists.txt: endif()
     -		COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx
     +		COMMAND ${SH_EXE} ${tsh} ${GIT_TEST_OPTS}
      		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
    -        set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT
    - 		    GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR})		
    + 	set_property(TEST ${tsh} APPEND PROPERTY ENVIRONMENT
    + 		GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR})
 -:  ----------- > 10:  966fec83b77 cmake: increase test timeout on Windows only
10:  ef6a304368c = 11:  aad17d8f858 cmake: copy over git-p4.py for t983[56] perforce test
11:  158a41ca7a4 = 12:  c27f620dfa3 CI: add a "linux-cmake-test" to run cmake & ctest on linux