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.
This commit is contained in:
Paul Kunysch 2013-03-06 00:14:58 +01:00 committed by Brad King
parent 3ed2d03ee9
commit 875eb8e158
5 changed files with 58 additions and 0 deletions

View File

@ -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.

View File

@ -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 ()

View File

@ -0,0 +1 @@
set(CTEST_PROJECT_NAME "CTestTestFdSetSize")

View File

@ -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;
}

View File

@ -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")