CTest: Refactor error output into ErrorMessageUnknownDashDValue

No behavior change. Prep work for defining script variables by
extending -D command line handling to recognize var:type=value syntax.
This commit is contained in:
David Cole 2012-06-24 05:33:32 -04:00
parent 0302287739
commit 24ba0fd078
2 changed files with 27 additions and 24 deletions

View File

@ -1944,35 +1944,33 @@ bool cmCTest::AddTestsForDashboardType(std::string &targ)
} }
else else
{ {
cmCTestLog(this, ERROR_MESSAGE,
"CTest -D called with incorrect option: "
<< targ << std::endl);
cmCTestLog(this, ERROR_MESSAGE, "Available options are:" << std::endl
<< " " << "ctest" << " -D Continuous" << std::endl
<< " " << "ctest"
<< " -D Continuous(Start|Update|Configure|Build)" << std::endl
<< " " << "ctest"
<< " -D Continuous(Test|Coverage|MemCheck|Submit)"
<< std::endl
<< " " << "ctest" << " -D Experimental" << std::endl
<< " " << "ctest"
<< " -D Experimental(Start|Update|Configure|Build)"
<< std::endl
<< " " << "ctest"
<< " -D Experimental(Test|Coverage|MemCheck|Submit)"
<< std::endl
<< " " << "ctest" << " -D Nightly" << std::endl
<< " " << "ctest"
<< " -D Nightly(Start|Update|Configure|Build)" << std::endl
<< " " << "ctest"
<< " -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl
<< " " << "ctest" << " -D NightlyMemoryCheck" << std::endl);
return false; return false;
} }
return true; return true;
} }
//----------------------------------------------------------------------
void cmCTest::ErrorMessageUnknownDashDValue(std::string &val)
{
cmCTestLog(this, ERROR_MESSAGE,
"CTest -D called with incorrect option: " << val << std::endl);
cmCTestLog(this, ERROR_MESSAGE,
"Available options are:" << std::endl
<< " ctest -D Continuous" << std::endl
<< " ctest -D Continuous(Start|Update|Configure|Build)" << std::endl
<< " ctest -D Continuous(Test|Coverage|MemCheck|Submit)" << std::endl
<< " ctest -D Experimental" << std::endl
<< " ctest -D Experimental(Start|Update|Configure|Build)" << std::endl
<< " ctest -D Experimental(Test|Coverage|MemCheck|Submit)" << std::endl
<< " ctest -D Nightly" << std::endl
<< " ctest -D Nightly(Start|Update|Configure|Build)" << std::endl
<< " ctest -D Nightly(Test|Coverage|MemCheck|Submit)" << std::endl
<< " ctest -D NightlyMemoryCheck" << std::endl);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
bool cmCTest::CheckArgument(const std::string& arg, const char* varg1, bool cmCTest::CheckArgument(const std::string& arg, const char* varg1,
const char* varg2) const char* varg2)
@ -2263,10 +2261,11 @@ int cmCTest::Run(std::vector<std::string> &args, std::string* output)
this->ProduceXML = true; this->ProduceXML = true;
i++; i++;
std::string targ = args[i]; std::string targ = args[i];
// AddTestsForDashboard parses the dashborad type and converts it // AddTestsForDashboard parses the dashboard type and converts it
// into the separate stages // into the separate stages
if (!this->AddTestsForDashboardType(targ)) if (!this->AddTestsForDashboardType(targ))
{ {
this->ErrorMessageUnknownDashDValue(targ);
performSomeTest = false; performSomeTest = false;
} }
} }

View File

@ -417,6 +417,7 @@ public:
bool GetLabelSummary() { return this->LabelSummary;} bool GetLabelSummary() { return this->LabelSummary;}
std::string GetCostDataFile(); std::string GetCostDataFile();
private: private:
std::string ConfigType; std::string ConfigType;
std::string ScheduleType; std::string ScheduleType;
@ -516,6 +517,9 @@ private:
//! parse the option after -D and convert it into the appropriate steps //! parse the option after -D and convert it into the appropriate steps
bool AddTestsForDashboardType(std::string &targ); bool AddTestsForDashboardType(std::string &targ);
//! read as "emit an error message for an unknown -D value"
void ErrorMessageUnknownDashDValue(std::string &val);
//! parse and process most common command line arguments //! parse and process most common command line arguments
void HandleCommandLineArguments(size_t &i, void HandleCommandLineArguments(size_t &i,
std::vector<std::string> &args); std::vector<std::string> &args);