summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-12-07 13:06:16 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-12-07 13:06:27 (GMT)
commitea63c522ef7561365c90e1e1f7c7e37403bac53b (patch)
tree3395b6686150f2ab1a269cf42c849e86d36f495a /Tests/RunCMake
parentf5e48edaae37fbf9afa668671b3a8d3e5537321b (diff)
parent935848a8a7164631b9410a0e6f7c5574b01bb85c (diff)
downloadCMake-ea63c522ef7561365c90e1e1f7c7e37403bac53b.zip
CMake-ea63c522ef7561365c90e1e1f7c7e37403bac53b.tar.gz
CMake-ea63c522ef7561365c90e1e1f7c7e37403bac53b.tar.bz2
Merge topic 'gtest-discovery-timeout'
935848a8 GoogleTest: Add test for missing test executable 29731d89 GoogleTest: Add timeout to discovery e99e3982 GoogleTest: Improve gtest_discover_tests messages Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1534
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt1
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt2
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt1
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt7
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest.cmake6
-rw-r--r--Tests/RunCMake/GoogleTest/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/GoogleTest/timeout_test.cpp15
7 files changed, 53 insertions, 0 deletions
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt
new file mode 100644
index 0000000..55a4a7a
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt
@@ -0,0 +1,2 @@
+Unable to find executable: timeout_test_NOT_BUILT
+Errors while running CTest
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt
new file mode 100644
index 0000000..8464c80
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt
@@ -0,0 +1,7 @@
+( *|[0-9]+>)CMake Error at .*GoogleTestAddTests.cmake:[0-9]+ \(message\):
+( *|[0-9]+>) Error running test executable.
+?( *|[0-9]+>)
+( *|[0-9]+>) Path: '.*timeout_test(\.exe)?'
+( *|[0-9]+>) Result: Process terminated due to timeout
+( *|[0-9]+>) Output:
+( *|[0-9]+>) +
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
index 58f4196..5e4b8ef 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
@@ -21,3 +21,9 @@ gtest_discover_tests(
EXTRA_ARGS how now "\"brown\" cow"
PROPERTIES LABELS TEST2
)
+
+add_executable(timeout_test timeout_test.cpp)
+
+gtest_discover_tests(
+ timeout_test
+)
diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
index b79af26..73014d1 100644
--- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
@@ -9,24 +9,45 @@ function(run_GoogleTest)
endif()
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
run_cmake(GoogleTest)
+
run_cmake_command(GoogleTest-build
${CMAKE_COMMAND}
--build .
--config Debug
+ --target fake_gtest
+ )
+
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(GoogleTest-timeout
+ ${CMAKE_COMMAND}
+ --build .
+ --config Debug
+ --target timeout_test
)
+ set(RunCMake_TEST_OUTPUT_MERGE 0)
+
run_cmake_command(GoogleTest-test1
${CMAKE_CTEST_COMMAND}
-C Debug
-L TEST1
--no-label-summary
)
+
run_cmake_command(GoogleTest-test2
${CMAKE_CTEST_COMMAND}
-C Debug
-L TEST2
--no-label-summary
)
+
+ run_cmake_command(GoogleTest-test-missing
+ ${CMAKE_CTEST_COMMAND}
+ -C Debug
+ -R timeout
+ --no-label-summary
+ )
endfunction()
run_GoogleTest()
diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp
new file mode 100644
index 0000000..a8e5c1c
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp
@@ -0,0 +1,15 @@
+#if defined(_WIN32)
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
+int main()
+{
+#if defined(_WIN32)
+ Sleep(10000);
+#else
+ sleep(10);
+#endif
+ return 0;
+}