CTest: Simplify Initialize method signature

We make the cmCTest::Initialize method private since it is only called
from inside the class implementation.  We also combine the two boolean
arguments into one since they both meant the same thing.
This commit is contained in:
Brad King 2009-11-24 08:58:48 -05:00
parent a03f801f7f
commit c2ba35787e
2 changed files with 15 additions and 9 deletions

View File

@ -311,8 +311,7 @@ cmCTest::Part cmCTest::GetPartFromName(const char* name)
}
//----------------------------------------------------------------------
int cmCTest::Initialize(const char* binary_dir, bool new_tag,
bool verbose_tag)
int cmCTest::Initialize(const char* binary_dir, bool script)
{
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
if(!this->InteractiveDebugMode)
@ -416,7 +415,7 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag,
}
tfin.close();
}
if (tag.size() == 0 || new_tag || this->Parts[PartStart])
if (tag.size() == 0 || script || this->Parts[PartStart])
{
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
<< std::endl);
@ -441,7 +440,7 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag,
ofs << this->GetTestModelString() << std::endl;
}
ofs.close();
if ( verbose_tag )
if ( !script )
{
cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - "
<< this->GetTestModelString() << std::endl);
@ -517,7 +516,7 @@ bool cmCTest::InitializeFromCommand(cmCTestCommand* command, bool first)
}
}
if ( !this->Initialize(bld_dir.c_str(), true, false) )
if ( !this->Initialize(bld_dir.c_str(), true) )
{
if ( this->GetCTestConfiguration("NightlyStartTime").empty() && first)
{
@ -2113,8 +2112,8 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
it->second->SetVerbose(this->Verbose);
it->second->SetSubmitIndex(this->SubmitIndex);
}
if ( !this->Initialize(
cmSystemTools::GetCurrentWorkingDirectory().c_str()) )
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
if(!this->Initialize(cwd.c_str(), false))
{
res = 12;
cmCTestLog(this, ERROR_MESSAGE, "Problem initializing the dashboard."

View File

@ -93,8 +93,6 @@ public:
/**
* Initialize and finalize testing
*/
int Initialize(const char* binary_dir, bool new_tag = false,
bool verbose_tag = true);
bool InitializeFromCommand(cmCTestCommand* command, bool first = false);
void Finalize();
@ -446,6 +444,15 @@ private:
void BlockTestErrorDiagnostics();
/**
* Initialize a dashboard run in the given build tree. The "script"
* argument is true when running from a command-driven (ctest_start)
* dashboard script, and false when running from the CTest command
* line. Note that a declarative dashboard script does not actually
* call this method because it sets CTEST_COMMAND to drive a build
* through the ctest command line.
*/
int Initialize(const char* binary_dir, bool script);
//! parse the option after -D and convert it into the appropriate steps
bool AddTestsForDashboardType(std::string &targ);