Merge topic 'ctest-bad-generator'

54111286 ctest_build: Do not crash on bad generator name
This commit is contained in:
Brad King 2014-05-08 11:27:59 -04:00 committed by CMake Topic Stage
commit 65a71a5db2
5 changed files with 51 additions and 0 deletions

View File

@ -112,6 +112,15 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
this->GlobalGenerator = this->GlobalGenerator =
this->Makefile->GetCMakeInstance()->CreateGlobalGenerator( this->Makefile->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGeneratorName); cmakeGeneratorName);
if(!this->GlobalGenerator)
{
std::string e = "could not create generator named \"";
e += cmakeGeneratorName;
e += "\"";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccured();
return 0;
}
} }
if(strlen(cmakeBuildConfiguration) == 0) if(strlen(cmakeBuildConfiguration) == 0)
{ {

View File

@ -2264,6 +2264,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
set_tests_properties(CTestTestBadExe PROPERTIES set_tests_properties(CTestTestBadExe PROPERTIES
PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}") PASS_REGULAR_EXPRESSION "${CTestTestBadExe_REGEX}")
configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestBadGenerator/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake"
@ONLY ESCAPE_QUOTES)
add_test(CTestTestBadGenerator ${CMAKE_CTEST_COMMAND}
-C "\${CTestTest_CONFIG}"
-S "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/test.cmake" -V
--output-log "${CMake_BINARY_DIR}/Tests/CTestTestBadGenerator/testOutput.log"
)
set_property(TEST CTestTestBadGenerator PROPERTY
PASS_REGULAR_EXPRESSION "could not create generator named \"Bad Generator\"")
configure_file( configure_file(
"${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in" "${CMake_SOURCE_DIR}/Tests/CTestTestParallel/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake" "${CMake_BINARY_DIR}/Tests/CTestTestParallel/test.cmake"

View File

@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.0)
project(CTestTestDepends NONE)
include(CTest)

View File

@ -0,0 +1,7 @@
set (CTEST_PROJECT_NAME "CTestTestBadGenerator")
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)

View File

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.0)
# Settings:
set(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
set(CTEST_SITE "@SITE@")
set(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Depends")
set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestBadGenerator")
set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestBadGenerator")
set(CTEST_CVS_COMMAND "@CVSCOMMAND@")
set(CTEST_CMAKE_GENERATOR "Bad Generator")
set(CTEST_CMAKE_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)
CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)