summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ctest_skipped_test
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2017-04-21 17:46:09 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2017-04-24 19:42:40 (GMT)
commitab8bbef9c6e588bc023ec8a773c78e33e3a61813 (patch)
tree200afa2cf5cf3f07cfbba6f7a7b224c19e8e06d7 /Tests/RunCMake/ctest_skipped_test
parent202a44a4cab0ebf2c89fb878cd2ee634fb83906c (diff)
downloadCMake-ab8bbef9c6e588bc023ec8a773c78e33e3a61813.zip
CMake-ab8bbef9c6e588bc023ec8a773c78e33e3a61813.tar.gz
CMake-ab8bbef9c6e588bc023ec8a773c78e33e3a61813.tar.bz2
cmCTestTestHandler: count skipped tests as disabled
The `Skipped` status is basically a runtime version of the `Disabled` status (set as a property on the test by the configure step), so treat them the same.
Diffstat (limited to 'Tests/RunCMake/ctest_skipped_test')
-rw-r--r--Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in12
-rw-r--r--Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in1
-rw-r--r--Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake51
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt11
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt13
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt13
-rw-r--r--Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt11
-rwxr-xr-xTests/RunCMake/ctest_skipped_test/skip.bat1
-rwxr-xr-xTests/RunCMake/ctest_skipped_test/skip.sh3
-rw-r--r--Tests/RunCMake/ctest_skipped_test/test.cmake.in16
10 files changed, 132 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in
new file mode 100644
index 0000000..cc4b8ed
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/CMakeLists.txt.in
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.8)
+project(@CASE_NAME@ C)
+include(CTest)
+
+if (WIN32)
+ set(skip_command "@CMAKE_CURRENT_LIST_DIR@/skip.bat")
+else ()
+ set(skip_command "@CMAKE_CURRENT_LIST_DIR@/skip.sh")
+endif ()
+
+add_test(NAME SuccessfulTest COMMAND "${CMAKE_COMMAND}" --version)
+@CASE_CMAKELISTS_SUFFIX_CODE@
diff --git a/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in b/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in
new file mode 100644
index 0000000..c0d7e42
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/CTestConfig.cmake.in
@@ -0,0 +1 @@
+set(CTEST_PROJECT_NAME "@CASE_NAME@")
diff --git a/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake
new file mode 100644
index 0000000..dcf5cd4
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/RunCMakeTest.cmake
@@ -0,0 +1,51 @@
+include(RunCTest)
+
+function(run_SkipTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125)
+ ]])
+ run_ctest(SkipTest)
+endfunction()
+run_SkipTest()
+
+function(run_SkipSetupTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+add_test(NAME SuccessfulCleanupTest COMMAND "${CMAKE_COMMAND}" --version)
+
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_SETUP "Foo")
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_REQUIRED "Foo")
+set_tests_properties(SuccessfulCleanupTest PROPERTIES FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipSetupTest)
+endfunction()
+run_SkipSetupTest()
+
+function(run_SkipRequiredTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME SkipTest COMMAND ${skip_command})
+add_test(NAME SuccessfulCleanupTest COMMAND "${CMAKE_COMMAND}" --version)
+
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_SETUP "Foo")
+set_tests_properties(SkipTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_REQUIRED "Foo")
+set_tests_properties(SuccessfulCleanupTest PROPERTIES FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipRequiredTest)
+endfunction()
+run_SkipRequiredTest()
+
+function(run_SkipCleanupTest)
+ set(CASE_CMAKELISTS_SUFFIX_CODE [[
+add_test(NAME CleanupTest COMMAND ${skip_command})
+
+set_tests_properties(SuccessfulTest PROPERTIES FIXTURES_REQUIRED "Foo")
+set_tests_properties(CleanupTest PROPERTIES SKIP_RETURN_CODE 125
+ FIXTURES_CLEANUP "Foo")
+ ]])
+ run_ctest(SkipCleanupTest)
+endfunction()
+run_SkipCleanupTest()
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt
new file mode 100644
index 0000000..e010eb2
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipCleanupTest-stdout.txt
@@ -0,0 +1,11 @@
+ Start 1: SuccessfulTest
+1/2 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: CleanupTest
+2/2 Test #2: CleanupTest ......................\*\*\*\Skipped +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests are disabled and did not run:
+.*2 \- CleanupTest
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt
new file mode 100644
index 0000000..8fa9a2c
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipRequiredTest-stdout.txt
@@ -0,0 +1,13 @@
+ Start 1: SuccessfulTest
+1/3 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: SkipTest
+2/3 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
+ Start 3: SuccessfulCleanupTest
+3/3 Test #3: SuccessfulCleanupTest ............ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 3
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests are disabled and did not run:
+.*2 \- SkipTest
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt
new file mode 100644
index 0000000..175d51a
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipSetupTest-stdout.txt
@@ -0,0 +1,13 @@
+ Start 2: SkipTest
+1/3 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
+ Start 1: SuccessfulTest
+2/3 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 3: SuccessfulCleanupTest
+3/3 Test #3: SuccessfulCleanupTest ............ Passed +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 3
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests are disabled and did not run:
+.*2 \- SkipTest
diff --git a/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt b/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt
new file mode 100644
index 0000000..bdaf744
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/SkipTest-stdout.txt
@@ -0,0 +1,11 @@
+ Start 1: SuccessfulTest
+1/2 Test #1: SuccessfulTest ................... Passed +[0-9.]+ sec
+ Start 2: SkipTest
+2/2 Test #2: SkipTest .........................\*\*\*\Skipped +[0-9.]+ sec
++
+100% tests passed, 0 tests failed out of 2
++
+Total Test time \(real\) = +[0-9.]+ sec
++
+The following tests are disabled and did not run:
+.*2 \- SkipTest
diff --git a/Tests/RunCMake/ctest_skipped_test/skip.bat b/Tests/RunCMake/ctest_skipped_test/skip.bat
new file mode 100755
index 0000000..80e1290
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/skip.bat
@@ -0,0 +1 @@
+EXIT 125
diff --git a/Tests/RunCMake/ctest_skipped_test/skip.sh b/Tests/RunCMake/ctest_skipped_test/skip.sh
new file mode 100755
index 0000000..f9c4603
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/skip.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 125
diff --git a/Tests/RunCMake/ctest_skipped_test/test.cmake.in b/Tests/RunCMake/ctest_skipped_test/test.cmake.in
new file mode 100644
index 0000000..ca23c83
--- /dev/null
+++ b/Tests/RunCMake/ctest_skipped_test/test.cmake.in
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(CTEST_SITE "test-site")
+set(CTEST_BUILD_NAME "test-build-name")
+set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+
+set(ctest_test_args "@CASE_CTEST_TEST_ARGS@")
+ctest_start(Experimental)
+ctest_configure()
+ctest_build()
+ctest_test(${ctest_test_args})