summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CTestCommandLine
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-28 17:45:04 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-28 17:45:04 (GMT)
commit4c33b4e3b10109288d59d7cd17853f814754b024 (patch)
treea379c917e1fe9e678ad2b2a6a183569d1c91c66d /Tests/RunCMake/CTestCommandLine
parent59d9fa713158610b6183b214841d0f272ee6f900 (diff)
parentdd6fd62615ef816f5cbdbd8cd5f827a5cc360464 (diff)
downloadCMake-4c33b4e3b10109288d59d7cd17853f814754b024.zip
CMake-4c33b4e3b10109288d59d7cd17853f814754b024.tar.gz
CMake-4c33b4e3b10109288d59d7cd17853f814754b024.tar.bz2
Merge branch 'master' into ci-msvc-14.29-16.10
Diffstat (limited to 'Tests/RunCMake/CTestCommandLine')
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/CTestCommandLine/output-junit-check.cmake36
-rw-r--r--Tests/RunCMake/CTestCommandLine/output-junit-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt17
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt17
-rw-r--r--Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt17
7 files changed, 103 insertions, 7 deletions
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index 6cf1476..afec011 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -202,7 +202,7 @@ function(run_TestLoad name load)
add_test(TestLoad1 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\")
add_test(TestLoad2 \"${CMAKE_COMMAND}\" -E echo \"test of --test-load\")
")
- run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -j2 --test-load ${load})
+ run_cmake_command(${name} ${CMAKE_CTEST_COMMAND} -VV -j2 --test-load ${load})
endfunction()
# Tests for the --test-load feature of ctest
@@ -397,3 +397,22 @@ function(run_testDir)
run_cmake_command(testDir ${CMAKE_CTEST_COMMAND} --test-dir "${RunCMake_TEST_BINARY_DIR}/sub")
endfunction()
run_testDir()
+
+# Test --output-junit
+function(run_output_junit)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/output-junit)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
+add_test(test1 \"${CMAKE_COMMAND}\" -E false)
+add_test(test2 \"${CMAKE_COMMAND}\" -E echo \"hello world\")
+add_test(test3 \"${CMAKE_COMMAND}\" -E true)
+set_tests_properties(test3 PROPERTIES DISABLED \"ON\")
+add_test(test4 \"${CMAKE_COMMAND}/doesnt_exist\")
+add_test(test5 \"${CMAKE_COMMAND}\" -E echo \"please skip\")
+set_tests_properties(test5 PROPERTIES SKIP_REGULAR_EXPRESSION \"please skip\")
+")
+ run_cmake_command(output-junit ${CMAKE_CTEST_COMMAND} --output-junit "${RunCMake_TEST_BINARY_DIR}/junit.xml")
+endfunction()
+run_output_junit()
diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake b/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake
new file mode 100644
index 0000000..b270fdf
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/output-junit-check.cmake
@@ -0,0 +1,36 @@
+file(GLOB junit_xml_file "${RunCMake_TEST_BINARY_DIR}/junit.xml")
+if(junit_xml_file)
+ file(READ "${junit_xml_file}" junit_xml LIMIT 4096)
+ if(NOT "${junit_xml}" MATCHES "tests=\"5\"")
+ set(RunCMake_TEST_FAILED "tests=\"5\" not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "failures=\"1\"")
+ set(RunCMake_TEST_FAILED "failures=\"1\" not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "disabled=\"1\"")
+ set(RunCMake_TEST_FAILED "disabled=\"1\" not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "skipped=\"2\"")
+ set(RunCMake_TEST_FAILED "skipped=\"2\" not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<system-out>hello world")
+ set(RunCMake_TEST_FAILED "<system-out>hello world not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<system-out>Disabled")
+ set(RunCMake_TEST_FAILED "<system-out>Disabled not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<skipped message=\"Unable to find executable\"/>")
+ set(RunCMake_TEST_FAILED "<skipped message=\"Unable to find executable\"/> not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<system-out>Unable to find executable:")
+ set(RunCMake_TEST_FAILED "<system-out>Unable to find executable: not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<skipped message=\"SKIP_REGULAR_EXPRESSION_MATCHED\"/>")
+ set(RunCMake_TEST_FAILED "<skipped message=\"SKIP_REGULAR_EXPRESSION_MATCHED\"/> not found when expected")
+ endif()
+ if(NOT "${junit_xml}" MATCHES "<system-out>please skip")
+ set(RunCMake_TEST_FAILED "<system-out>please skip not found when expected")
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "junit.xml not found")
+endif()
diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-result.txt b/Tests/RunCMake/CTestCommandLine/output-junit-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/output-junit-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt
new file mode 100644
index 0000000..ce30dc8
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/output-junit-stderr.txt
@@ -0,0 +1 @@
+Unable to find executable: .*doesnt_exist
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt
index 7ee3dae..5101985 100644
--- a/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt
+++ b/Tests/RunCMake/CTestCommandLine/test-load-invalid-stdout.txt
@@ -1,7 +1,20 @@
-^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/TestLoad(
+[^*][^
+]*)*
+test 1
Start 1: TestLoad1
++(
+[^*][^
+]*)*
+test 2
Start 2: TestLoad2
-1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
++(
+[^*][^
+]*)*
+1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec(
+[^*][^
+]*)*
2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
+
100% tests passed, 0 tests failed out of 2
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt
index 7ee3dae..5101985 100644
--- a/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt
+++ b/Tests/RunCMake/CTestCommandLine/test-load-pass-stdout.txt
@@ -1,7 +1,20 @@
-^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/TestLoad(
+[^*][^
+]*)*
+test 1
Start 1: TestLoad1
++(
+[^*][^
+]*)*
+test 2
Start 2: TestLoad2
-1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
++(
+[^*][^
+]*)*
+1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec(
+[^*][^
+]*)*
2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
+
100% tests passed, 0 tests failed out of 2
diff --git a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt
index 11a768a..db7d7f3 100644
--- a/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt
+++ b/Tests/RunCMake/CTestCommandLine/test-load-wait-stdout.txt
@@ -1,8 +1,21 @@
-^Test project .*/Tests/RunCMake/CTestCommandLine/TestLoad
+Test project [^
+]*/Tests/RunCMake/CTestCommandLine/TestLoad(
+[^*][^
+]*)*
\*\*\*\*\* WAITING, System Load: 5, Max Allowed Load: 3, Smallest test TestLoad[1-2] requires 1\*\*\*\*\*
+test 1
Start 1: TestLoad1
++(
+[^*][^
+]*)*
+test 2
Start 2: TestLoad2
-1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
++(
+[^*][^
+]*)*
+1/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec(
+[^*][^
+]*)*
2/2 Test #[1-2]: TestLoad[1-2] ........................ Passed +[0-9.]+ sec
+
100% tests passed, 0 tests failed out of 2