diff options
author | Asit Dhal <dhal.asitk@gmail.com> | 2020-12-16 16:14:26 (GMT) |
---|---|---|
committer | Asit Dhal <dhal.asitk@gmail.com> | 2020-12-17 04:01:03 (GMT) |
commit | dbcf86d24d9e0d762e97e3a4b492739f99816c13 (patch) | |
tree | 33514dd1556487d9518f2d122c25d951cd16cedf /Tests/RunCMake/CTestCommandLine | |
parent | 0f61fac6f028214d64ef6a407c6b98d4503ee2fe (diff) | |
download | CMake-dbcf86d24d9e0d762e97e3a4b492739f99816c13.zip CMake-dbcf86d24d9e0d762e97e3a4b492739f99816c13.tar.gz CMake-dbcf86d24d9e0d762e97e3a4b492739f99816c13.tar.bz2 |
Ctest: Support build tree on command line
Fixes: #21268
Diffstat (limited to 'Tests/RunCMake/CTestCommandLine')
6 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index e05ad79..6cf1476 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -380,3 +380,20 @@ run_MemCheckSan(Leak "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode run_MemCheckSan(Memory "simulate_sanitizer=1:report_bugs=1:history_size=5:exitcode=55") run_MemCheckSan(Thread "report_bugs=1:history_size=5:exitcode=55") run_MemCheckSan(UndefinedBehavior "simulate_sanitizer=1") + +run_cmake_command(test-dir-invalid-arg ${CMAKE_CTEST_COMMAND} --test-dir) +run_cmake_command(test-dir-non-existing-dir ${CMAKE_CTEST_COMMAND} --test-dir non-existing-dir) + +function(run_testDir) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/testDir) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/sub") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/sub/CTestTestfile.cmake" " + add_test(Test1 \"${CMAKE_COMMAND}\" -E true) + add_test(Test2 \"${CMAKE_COMMAND}\" -E true) + ") + run_cmake_command(testDir ${CMAKE_CTEST_COMMAND} --test-dir "${RunCMake_TEST_BINARY_DIR}/sub") +endfunction() +run_testDir() diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-result.txt b/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-stderr.txt new file mode 100644 index 0000000..15908a7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-dir-invalid-arg-stderr.txt @@ -0,0 +1 @@ +CMake Error: '--test-dir' requires an argument diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-result.txt b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt new file mode 100644 index 0000000..017ccb0 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stderr.txt @@ -0,0 +1 @@ +Failed to change working directory to ".*/non-existing-dir" : No such file or directory diff --git a/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt new file mode 100644 index 0000000..ddcd238 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/test-dir-non-existing-dir-stdout.txt @@ -0,0 +1 @@ +Internal ctest changing into directory: .*/non-existing-dir |