diff options
author | Paul Kunysch <kunysch@me.com> | 2013-03-05 23:14:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-03-22 13:02:12 (GMT) |
commit | 875eb8e158e9b8541b2efab09df44b32c6854f04 (patch) | |
tree | 82bed8297c805cfb51521cf9ea7d9bc8c23db613 | |
parent | 3ed2d03ee9ed9736656c8021e8f740540c9a2b7a (diff) | |
download | CMake-875eb8e158e9b8541b2efab09df44b32c6854f04.zip CMake-875eb8e158e9b8541b2efab09df44b32c6854f04.tar.gz CMake-875eb8e158e9b8541b2efab09df44b32c6854f04.tar.bz2 |
CTest: Add test for running many tests in parallel
In particular, this checks that CTest's use of select() has a sufficient
file descriptor set size limit (FD_SETSIZE) to handle many child
processes at the same time. Running 20 tests requires more than 64
descriptors, the Cygwin default that we override.
-rw-r--r-- | Tests/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/CTestTestFdSetSize/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/CTestTestFdSetSize/CTestConfig.cmake | 1 | ||||
-rw-r--r-- | Tests/CTestTestFdSetSize/sleep.c | 16 | ||||
-rw-r--r-- | Tests/CTestTestFdSetSize/test.cmake.in | 23 |
5 files changed, 58 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index e07bb69..283c846 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2085,6 +2085,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ add_test(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B) + configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestFdSetSize/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestFdSetSize ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/test.cmake" -j20 -V --timeout 120 + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestFdSetSize/testOutput.log" + ) + # Use macro, not function so that build can still be driven by CMake 2.4. # After 2.6 is required, this could be a function without the extra 'set' # calls. diff --git a/Tests/CTestTestFdSetSize/CMakeLists.txt b/Tests/CTestTestFdSetSize/CMakeLists.txt new file mode 100644 index 0000000..f382746 --- /dev/null +++ b/Tests/CTestTestFdSetSize/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required (VERSION 2.8.10) +project (CTestTestFdSetSize) +include (CTest) + +add_executable (Sleep sleep.c) + +foreach (index RANGE 1 20) + add_test (TestSleep${index} Sleep) +endforeach () diff --git a/Tests/CTestTestFdSetSize/CTestConfig.cmake b/Tests/CTestTestFdSetSize/CTestConfig.cmake new file mode 100644 index 0000000..b5f3c33 --- /dev/null +++ b/Tests/CTestTestFdSetSize/CTestConfig.cmake @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestTestFdSetSize") diff --git a/Tests/CTestTestFdSetSize/sleep.c b/Tests/CTestTestFdSetSize/sleep.c new file mode 100644 index 0000000..b2e6a87 --- /dev/null +++ b/Tests/CTestTestFdSetSize/sleep.c @@ -0,0 +1,16 @@ +#if defined(_WIN32) +# include <windows.h> +#else +# include <unistd.h> +#endif + +/* sleeps for 0.1 second */ +int main(int argc, char** argv) +{ +#if defined(_WIN32) + Sleep(100); +#else + usleep(100 * 1000); +#endif + return 0; +} diff --git a/Tests/CTestTestFdSetSize/test.cmake.in b/Tests/CTestTestFdSetSize/test.cmake.in new file mode 100644 index 0000000..c24f505 --- /dev/null +++ b/Tests/CTestTestFdSetSize/test.cmake.in @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 2.8.10) + +# Settings: +set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +set(CTEST_SITE "@SITE@") +set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-FdSetSize") + +set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestFdSetSize") +set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestFdSetSize") +set(CTEST_CVS_COMMAND "@CVSCOMMAND@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@CMAKE_TEST_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +set(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +ctest_start(Experimental) +ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +message("build") +ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +message("test") +ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 20 RETURN_VALUE res) +message("done") |