CTest: Simplify ctest_* command source/build dir lookup

In cmCTestHandlerCommand::InitialPass call InitializeHandler after setting
the CTest "SourceDirectory" and "BuildDirectory" configuration values
instead of before.  This makes the values available to InitializeHandler
methods in subclasses, so also drop the duplicate configuration of those
values from cmCTestConfigureCommand::InitializeHandler.
This commit is contained in:
Brad King 2013-03-28 10:05:42 -04:00
parent 1ca93182ad
commit a6c0299c40
2 changed files with 14 additions and 39 deletions

View File

@ -31,32 +31,6 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
cmSystemTools::ExpandListArgument(this->Values[ctc_OPTIONS], options); cmSystemTools::ExpandListArgument(this->Values[ctc_OPTIONS], options);
} }
if ( this->Values[ct_BUILD] )
{
this->CTest->SetCTestConfiguration("BuildDirectory",
cmSystemTools::CollapseFullPath(
this->Values[ct_BUILD]).c_str());
}
else
{
this->CTest->SetCTestConfiguration("BuildDirectory",
cmSystemTools::CollapseFullPath(
this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY")).c_str());
}
if ( this->Values[ct_SOURCE] )
{
this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath(
this->Values[ct_SOURCE]).c_str());
}
else
{
this->CTest->SetCTestConfiguration("SourceDirectory",
cmSystemTools::CollapseFullPath(
this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str());
}
if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() ) if ( this->CTest->GetCTestConfiguration("BuildDirectory").empty() )
{ {
this->SetError("Build directory not specified. Either use BUILD " this->SetError("Build directory not specified. Either use BUILD "

View File

@ -70,19 +70,6 @@ bool cmCTestHandlerCommand
this->CTest->SetConfigType(ctestConfigType); this->CTest->SetConfigType(ctestConfigType);
} }
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
cmCTestGenericHandler* handler = this->InitializeHandler();
if ( !handler )
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot instantiate test handler " << this->GetName()
<< std::endl);
return false;
}
handler->SetAppendXML(this->AppendXML);
handler->PopulateCustomVectors(this->Makefile);
if ( this->Values[ct_BUILD] ) if ( this->Values[ct_BUILD] )
{ {
this->CTest->SetCTestConfiguration("BuildDirectory", this->CTest->SetCTestConfiguration("BuildDirectory",
@ -119,6 +106,20 @@ bool cmCTestHandlerCommand
cmSystemTools::CollapseFullPath( cmSystemTools::CollapseFullPath(
this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str()); this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")).c_str());
} }
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
cmCTestGenericHandler* handler = this->InitializeHandler();
if ( !handler )
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot instantiate test handler " << this->GetName()
<< std::endl);
return false;
}
handler->SetAppendXML(this->AppendXML);
handler->PopulateCustomVectors(this->Makefile);
if ( this->Values[ct_SUBMIT_INDEX] ) if ( this->Values[ct_SUBMIT_INDEX] )
{ {
if(!this->CTest->GetDropSiteCDash() && this->CTest->GetDartVersion() <= 1) if(!this->CTest->GetDropSiteCDash() && this->CTest->GetDartVersion() <= 1)