summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-06 16:38:53 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-10 16:52:23 +0200
commit2a86ea10ae45bce6d9773b1250152e8a392ddc4e (patch)
treea01de5f4be11ba1f654cc2dcf949ab50287da489 /src
parent326c7ecdfd8586ef5558e681bd0bd21421801e54 (diff)
CMake: Allow passing arguments to tests/auto/cmake test command
Useful to pass -V if the test command is 'ctest'. Change-Id: I77193ff2c15d8df4de71730f66afc0ee87953384 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/Qt6CTestMacros.cmake8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/Qt6CTestMacros.cmake b/src/corelib/Qt6CTestMacros.cmake
index 1ee7f46e8b..04595a776d 100644
--- a/src/corelib/Qt6CTestMacros.cmake
+++ b/src/corelib/Qt6CTestMacros.cmake
@@ -134,13 +134,17 @@ endfunction()
#
# BINARY: Path to the test artifact that will be executed after the build is complete. If a
# relative path is specified, it will be counted from the build directory.
+# Can also be passed a random executable to be found in PATH, like 'ctest'.
+#
+# BINARY_ARGS: Additional arguments to pass to the BINARY.
#
# TESTNAME: a custom test name to use instead of the one derived from the source directory name
#
# BUILD_OPTIONS: a list of -D style CMake definitions to pass to ctest's --build-options (which
# are ultimately passed to the CMake invocation of the test project)
macro(_qt_internal_test_expect_pass _dir)
- cmake_parse_arguments(_ARGS "SIMULATE_IN_SOURCE" "BINARY;TESTNAME" "BUILD_OPTIONS" ${ARGN})
+ cmake_parse_arguments(_ARGS "SIMULATE_IN_SOURCE" "BINARY;TESTNAME" "BUILD_OPTIONS;BINARY_ARGS"
+ ${ARGN})
if(_ARGS_TESTNAME)
set(testname "${_ARGS_TESTNAME}")
else()
@@ -192,7 +196,7 @@ macro(_qt_internal_test_expect_pass _dir)
--build-project "${_dir}"
--build-options "-DCMAKE_PREFIX_PATH=${__expect_pass_prefixes}" ${BUILD_OPTIONS_LIST}
${_ARGS_BUILD_OPTIONS}
- --test-command ${_ARGS_BINARY}
+ --test-command ${_ARGS_BINARY} ${_ARGS_BINARY_ARGS}
)
add_test(${testname} ${CMAKE_CTEST_COMMAND} ${ctest_command_args})
if(_ARGS_SIMULATE_IN_SOURCE)