[PATCH 7/9] cmake: support using GIT_TEST_OPTS from the environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Get "GIT_TEST_OPTS" from the environment, and use it to pass arguments
to tests. This allows for passing arguments to tests with e.g.:

	GIT_TEST_OPTS="--verbose --debug" cmake .; ctest -R t0001 --verbose

There's some overlap with this and what was suggested in [1], but as
noted there we're not passing "--verbose" and friends unconditionally,
so a plain "ctest" invocation without a "cmake" re-build won't pick up
the options.

1. https://lore.kernel.org/git/356b2e9a1007bcd1382f26f333926ff0d5b9abe2.1666090745.git.gitgitgadget@xxxxxxxxx/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 contrib/buildsystems/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 91b7009f4fd..8e29e3f514b 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1083,9 +1083,11 @@ endif()
 file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh")
 
 #test
+set(GIT_TEST_OPTS "$ENV{GIT_TEST_OPTS}")
+separate_arguments(GIT_TEST_OPTS)
 foreach(tsh ${test_scipts})
 	add_test(NAME ${tsh}
-		COMMAND env GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR} ${SH_EXE} ${tsh}
+		COMMAND env GIT_TEST_BUILD_DIR=${CMAKE_BINARY_DIR} ${SH_EXE} ${tsh} ${GIT_TEST_OPTS}
 		WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t)
 endforeach()
 
-- 
2.38.0.1205.gcea0601d673




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux