summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Goulet <robert.goulet.qc@gmail.com>2019-12-28 05:20:05 (GMT)
committerBrad King <brad.king@kitware.com>2020-01-15 20:02:56 (GMT)
commit4153d8445bf107f2637ceaca63804f4668fb9305 (patch)
treea9c7afeb571f8017a2cbb86e2234dfc7fd5b8b5f /Tests
parent93526fd91319d952e60760c735a9bb191bc4ede3 (diff)
downloadCMake-4153d8445bf107f2637ceaca63804f4668fb9305.zip
CMake-4153d8445bf107f2637ceaca63804f4668fb9305.tar.gz
CMake-4153d8445bf107f2637ceaca63804f4668fb9305.tar.bz2
Add CMAKE_CTEST_ARGUMENTS variable to pass command-line arguments to ctest
Fixes: #20172
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CTest/CMakeCTestArguments-test-check.cmake4
-rw-r--r--Tests/RunCMake/CTest/CMakeCTestArguments.cmake2
-rw-r--r--Tests/RunCMake/CTest/RunCMakeTest.cmake13
3 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTest/CMakeCTestArguments-test-check.cmake b/Tests/RunCMake/CTest/CMakeCTestArguments-test-check.cmake
new file mode 100644
index 0000000..3e05953
--- /dev/null
+++ b/Tests/RunCMake/CTest/CMakeCTestArguments-test-check.cmake
@@ -0,0 +1,4 @@
+set(log "${RunCMake_TEST_BINARY_DIR}/output-log.txt")
+if(NOT EXISTS "${log}")
+ set(RunCMake_TEST_FAILED "The expected output log file is missing:\n ${log}")
+endif()
diff --git a/Tests/RunCMake/CTest/CMakeCTestArguments.cmake b/Tests/RunCMake/CTest/CMakeCTestArguments.cmake
new file mode 100644
index 0000000..37f2933
--- /dev/null
+++ b/Tests/RunCMake/CTest/CMakeCTestArguments.cmake
@@ -0,0 +1,2 @@
+include(CTest)
+add_test(NAME CMakeCTestArguments COMMAND ${CMAKE_COMMAND} -E echo CMakeCTestArguments)
diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake
index 1392240..761224a 100644
--- a/Tests/RunCMake/CTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake
@@ -5,3 +5,16 @@ run_cmake(BeforeProject)
unset(RunCMake_TEST_OPTIONS)
run_cmake(NotOn)
+
+function(run_CMakeCTestArguments)
+ run_cmake_with_options(CMakeCTestArguments "-DCMAKE_CTEST_ARGUMENTS=--quiet\\;--output-log\\;output-log.txt")
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CMakeCTestArguments-build)
+ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+ set(test "test")
+ else()
+ set(test "RUN_TESTS")
+ endif()
+ run_cmake_command(CMakeCTestArguments-test ${CMAKE_COMMAND} --build . --config Debug --target "${test}")
+endfunction()
+run_CMakeCTestArguments()