Commit 51bb4935 authored by Zach's avatar Zach
Browse files

Test TIMEOUT property explicitly set to zero should be honored

parent edff9207
......@@ -455,7 +455,8 @@ bool cmCTestRunTest::StartTest(size_t total)
{
return false;
}
return this->ForkProcess(timeout, &this->TestProperties->Environment);
return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout,
&this->TestProperties->Environment);
}
//----------------------------------------------------------------------
......@@ -598,7 +599,7 @@ double cmCTestRunTest::ResolveTimeout()
}
//----------------------------------------------------------------------
bool cmCTestRunTest::ForkProcess(double testTimeOut,
bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment)
{
this->TestProcess = new cmProcess;
......@@ -619,12 +620,16 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut,
{
timeout = testTimeOut;
}
// always have at least 1 second if we got to here
if (timeout <= 0)
{
timeout = 1;
}
// handle timeout explicitly set to 0
if (testTimeOut == 0 && explicitTimeout)
{
timeout = 0;
}
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": "
<< "Test timeout computed to be: " << timeout << "\n");
......
......@@ -63,8 +63,8 @@ private:
void ExeNotFound(std::string exe);
// Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT)
double ResolveTimeout();
bool ForkProcess(double testTimeOut,
std::vector<std::string>* environment);
bool ForkProcess(double testTimeOut, bool explicitTimeout,
std::vector<std::string>* environment);
void WriteLogOutputTop(size_t completed, size_t total);
//Run post processing of the process output for MemCheck
void MemCheckPostProcess();
......
......@@ -2122,6 +2122,7 @@ bool cmCTestTestHandler::SetTestsProperties(
if ( key == "TIMEOUT" )
{
rtit->Timeout = atof(val.c_str());
rtit->ExplicitTimeout = true;
}
if ( key == "COST" )
{
......@@ -2295,6 +2296,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.WillFail = false;
test.RunSerial = false;
test.Timeout = 0;
test.ExplicitTimeout = false;
test.Cost = 0;
test.Processors = 1;
test.PreviousRuns = 0;
......
......@@ -99,6 +99,7 @@ public:
int PreviousRuns;
bool RunSerial;
double Timeout;
bool ExplicitTimeout;
int Index;
//Requested number of process slots
int Processors;
......
......@@ -45,18 +45,18 @@ IF(BUILD_TESTING)
SET(TEST_BUILD_DIRS)
# Should the long tests be run?
OPTION(CMAKE_RUN_LONG_TESTS
OPTION(CMAKE_RUN_LONG_TESTS
"Should the long tests be run (such as Bootstrap)." ON)
MARK_AS_ADVANCED(CMAKE_RUN_LONG_TESTS)
IF (CMAKE_RUN_LONG_TESTS)
OPTION(CTEST_TEST_CTEST
"Should the tests that run a full sub ctest process be run?"
OPTION(CTEST_TEST_CTEST
"Should the tests that run a full sub ctest process be run?"
OFF)
MARK_AS_ADVANCED(CTEST_TEST_CTEST)
OPTION(TEST_KDE4_STABLE_BRANCH
"Should the KDE4 stable branch test be run?"
"Should the KDE4 stable branch test be run?"
OFF)
MARK_AS_ADVANCED(TEST_KDE4_STABLE_BRANCH)
ENDIF (CMAKE_RUN_LONG_TESTS)
......@@ -214,7 +214,7 @@ IF(BUILD_TESTING)
# If we are running right now with a UnixMakefiles based generator,
# build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately),
# This doesn't test whether the generated project files work (unfortunately),
# mainly it tests that cmake doesn't crash when generating these project files.
IF(${CMAKE_TEST_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_TEST_GENERATOR} MATCHES "KDevelop")
# check which generators we have
......@@ -286,10 +286,10 @@ IF(BUILD_TESTING)
ADD_TEST(SubProject-Stage2 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubProject/foo"
"${CMake_BINARY_DIR}/Tests/SubProject/foo"
"${CMake_BINARY_DIR}/Tests/SubProject/foo"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-nocmake
--build-nocmake
--build-project foo
--build-target foo
--test-command foo
......@@ -347,7 +347,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project TargetName
--test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
--test-command ${CMAKE_CMAKE_COMMAND} -E compare_files
${CMake_SOURCE_DIR}/Tests/TargetName/scripts/hello_world
${CMake_BINARY_DIR}/Tests/TargetName/scripts/hello_world)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TargetName")
......@@ -359,7 +359,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project LibName
--build-project LibName
--build-exe-dir "${CMake_BINARY_DIR}/Tests/LibName/lib"
--test-command foobar
)
......@@ -372,7 +372,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project CustComDepend
--build-project CustComDepend
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustComDepend/bin"
--test-command foo bar.c
)
......@@ -451,7 +451,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
SET(SimpleInstallInstallDir
"${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
......@@ -884,7 +884,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# RPATH isn't supported under Syllable, so the tests don't
# find their libraries. In order to fix that LIBRARY_OUTPUT_DIR
# in the tests would have to be adjusted to ${EXECUTABLE_OUTPUT_DIR}/lib .
# For now we just require on Syllable that the user adjusts the DLL_PATH
# For now we just require on Syllable that the user adjusts the DLL_PATH
# environment variable, so except the two tests below all other tests will succeed.
SET(_DLL_PATH "$ENV{DLL_PATH}")
......@@ -993,14 +993,14 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
# only add this test on platforms that support it
# some old versions of make simply cannot handle spaces in paths
IF (MAKE_IS_GNU OR
IF (MAKE_IS_GNU OR
"${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
"${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
ADD_TEST(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
"${CMake_BINARY_DIR}/Tests/SubDirSpaces"
--build-exe-dir
--build-exe-dir
"${CMake_BINARY_DIR}/Tests/SubDirSpaces/Executable Sources"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
......@@ -1106,7 +1106,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"${CMake_BINARY_DIR}/Tests/BundleGeneratorTest"
--build-two-config
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project BundleGeneratorTest
--build-target package
--build-options "-DCMAKE_INSTALL_PREFIX:PATH=${CMake_BINARY_DIR}/Tests/BundleGeneratorTest/InstallDirectory"
......@@ -1341,7 +1341,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
SET_TESTS_PROPERTIES(CTestTestCrash PROPERTIES
PASS_REGULAR_EXPRESSION "SegFault")
ENDIF(CMAKE_TEST_GENERATOR MATCHES "Watcom WMake")
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestBadExe/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestBadExe/test.cmake"
......@@ -1419,7 +1419,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
#make sure all 3 subdirs were added
SET_TESTS_PROPERTIES(CTestTestSubdir PROPERTIES
PASS_REGULAR_EXPRESSION "0 tests failed out of 3")
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake"
......@@ -1432,6 +1432,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
SET_TESTS_PROPERTIES(CTestTestTimeout PROPERTIES
PASS_REGULAR_EXPRESSION "TestTimeout *\\.+ *\\*\\*\\*Timeout.*CheckChild *\\.+ *Passed")
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestZeroTimeout/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake"
@ONLY ESCAPE_QUOTES)
ADD_TEST(CTestTestZeroTimeout ${CMAKE_CTEST_COMMAND}
-S "${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/test.cmake" -V
--output-log
"${CMake_BINARY_DIR}/Tests/CTestTestZeroTimeout/testOutput.log")
SET_TESTS_PROPERTIES(CTestTestZeroTimeout PROPERTIES
FAIL_REGULAR_EXPRESSION "\\*\\*\\*Timeout")
CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestDepends/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestDepends/test.cmake"
......@@ -1614,7 +1625,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF(UNIX)
ENDIF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
......@@ -1641,7 +1652,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--build-noclean
--build-makeprogram ${bootstrap}
--build-generator "${CMAKE_TEST_GENERATOR}"
--test-command
--test-command
${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BootstrapTest")
# Make this test run early during parallel execution
......@@ -1735,8 +1746,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"-DCMAKE_C_COMPILER=${SDCC_EXECUTABLE}")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/SimpleCOnly_sdcc")
ENDIF(SDCC_EXECUTABLE)
FIND_PROGRAM(MINGW_CC_LINUX2WIN_EXECUTABLE i586-mingw32msvc-gcc)
FIND_PROGRAM(MINGW_CXX_LINUX2WIN_EXECUTABLE i586-mingw32msvc-g++)
MARK_AS_ADVANCED(MINGW_CC_LINUX2WIN_EXECUTABLE MINGW_CXX_LINUX2WIN_EXECUTABLE)
......@@ -1754,8 +1765,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
"-DCMAKE_CXX_COMPILER=${MINGW_CXX_LINUX2WIN_EXECUTABLE}")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Simple_Mingw_Linux2Win")
ENDIF(MINGW_CC_LINUX2WIN_EXECUTABLE AND MINGW_CXX_LINUX2WIN_EXECUTABLE)
ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")
IF(UNIX)
......
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (CTestTestZeroTimeout)
INCLUDE (CTest)
ADD_EXECUTABLE (Sleep sleep.c)
ADD_TEST (TestExplicitZeroTimeout Sleep)
SET_TESTS_PROPERTIES(TestExplicitZeroTimeout PROPERTIES TIMEOUT 0)
set(CTEST_PROJECT_NAME "CTestTestZeroTimeout")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set(CTEST_DART_SERVER_VERSION "2")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
set(CTEST_DROP_SITE_CDASH TRUE)
#if defined(_WIN32)
# include <windows.h>
#else
# include <unistd.h>
#endif
/* sleeps for 5 seconds */
int main(int argc, char** argv)
{
#if defined(_WIN32)
Sleep(5000);
#else
sleep(5);
#endif
return 0;
}
CMAKE_MINIMUM_REQUIRED(VERSION 2.1)
# Settings:
SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
SET(CTEST_SITE "@SITE@")
SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-ZeroTimeout")
SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestZeroTimeout")
SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestZeroTimeout")
SET(CTEST_CVS_COMMAND "@CVSCOMMAND@")
SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@")
SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@")
SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@")
SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@")
SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
SET(CTEST_TEST_TIMEOUT 2)
CTEST_START(Experimental)
CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment