BUG: fix for bug #8224 fix crash

This commit is contained in:
Bill Hoffman 2008-12-18 21:57:42 -05:00
parent 46feb1302c
commit 5b1139caea
2 changed files with 50 additions and 8 deletions

View File

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

View File

@ -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)
{
abort();
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)
{
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;
}