summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-12-19 02:57:42 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-12-19 02:57:42 (GMT)
commit5b1139caea7d732c19c584acad2a24669cdb7171 (patch)
tree1da31804a741216c3dbaa5ef61306b80973b46f5
parent46feb1302c50d9031d25fc865d34c17e5e88c66f (diff)
downloadCMake-5b1139caea7d732c19c584acad2a24669cdb7171.zip
CMake-5b1139caea7d732c19c584acad2a24669cdb7171.tar.gz
CMake-5b1139caea7d732c19c584acad2a24669cdb7171.tar.bz2
BUG: fix for bug #8224 fix crash
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx20
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx38
2 files changed, 50 insertions, 8 deletions
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index 56baab6..eea8633 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -54,9 +54,7 @@ bool cmCTestHandlerCommand
return false;
}
- cmCTestLog(this->CTest, DEBUG, "Populate Custom Vectors" << std::endl;);
handler->PopulateCustomVectors(this->Makefile);
-
if ( this->Values[ct_BUILD] )
{
this->CTest->SetCTestConfiguration("BuildDirectory",
@@ -65,9 +63,20 @@ bool cmCTestHandlerCommand
}
else
{
- this->CTest->SetCTestConfiguration("BuildDirectory",
- cmSystemTools::CollapseFullPath(
- this->Makefile->GetDefinition("CTEST_BINARY_DIRECTORY")).c_str());
+ const char* bdir =
+ this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
+ if(bdir)
+ {
+ this->
+ CTest->SetCTestConfiguration("BuildDirectory",
+ cmSystemTools::CollapseFullPath(bdir).c_str());
+ }
+ else
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ "CTEST_BINARY_DIRECTORY not set" << std::endl;);
+ }
+
}
if ( this->Values[ct_SOURCE] )
{
@@ -98,7 +107,6 @@ bool cmCTestHandlerCommand
handler->SetSubmitIndex(atoi(this->Values[ct_SUBMIT_INDEX]));
}
}
-
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(
this->CTest->GetCTestConfiguration("BuildDirectory").c_str());
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index db54c92..ef8e924 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -274,13 +274,47 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
int result = cmsysProcess_GetState(cp);
int retVal = 0;
+ bool failed = false;
if(result == cmsysProcess_State_Exited)
{
retVal = cmsysProcess_GetExitValue(cp);
}
- else
+ else if(result == cmsysProcess_State_Exception)
+ {
+ retVal = cmsysProcess_GetExitException(cp);
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was an exception: "
+ << cmsysProcess_GetExceptionString(cp) << " " <<
+ retVal << std::endl);
+ failed = true;
+ }
+ else if(result == cmsysProcess_State_Expired)
{
- abort();
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "\tThere was a timeout"
+ << std::endl);
+ failed = true;
+ }
+ else if(result == cmsysProcess_State_Error)
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "\tError executing ctest: "
+ << cmsysProcess_GetErrorString(cp) << std::endl);
+ failed = true;
+ }
+ if(failed)
+ {
+ cmOStringStream message;
+ message << "Error running command: [";
+ message << result << "] ";
+ for(std::vector<const char*>::iterator i = argv.begin();
+ i != argv.end(); ++i)
+ {
+ if(*i)
+ {
+ message << *i << " ";
+ }
+ }
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
+ message.str() << argv[0] << std::endl);
+ return -1;
}
return retVal;
}