ENH: Improve syntax
This commit is contained in:
parent
082b3b44d7
commit
9619d54003
|
@ -24,16 +24,55 @@
|
|||
bool cmCTestBuildCommand::InitialPass(
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
const char* build_dir = 0;
|
||||
const char* res_var = 0;
|
||||
|
||||
bool havereturn_variable = false;
|
||||
bool havesource = false;
|
||||
for(size_t i=0; i < args.size(); ++i)
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
if ( havereturn_variable )
|
||||
{
|
||||
res_var = args[i].c_str();
|
||||
havereturn_variable = false;
|
||||
}
|
||||
else if ( havesource )
|
||||
{
|
||||
build_dir = args[i].c_str();
|
||||
havesource = false;
|
||||
}
|
||||
else if(args[i] == "RETURN_VALUE")
|
||||
{
|
||||
if ( res_var )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havereturn_variable = true;
|
||||
}
|
||||
else if(args[i] == "BUILD")
|
||||
{
|
||||
if ( build_dir )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
|
||||
return false;
|
||||
}
|
||||
havesource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
|
||||
this->SetError(str.str().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const char* build_dir = args[0].c_str();
|
||||
const char* res_var = args[1].c_str();
|
||||
if ( build_dir )
|
||||
{
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
}
|
||||
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
cmCTestGenericHandler* handler = m_CTest->GetHandler("build");
|
||||
if ( !handler )
|
||||
{
|
||||
|
@ -62,7 +101,6 @@ bool cmCTestBuildCommand::InitialPass(
|
|||
m_Makefile->GetCMakeInstance()->CreateGlobalGenerator(cmakeGeneratorName);
|
||||
gen->FindMakeProgram(m_Makefile);
|
||||
const char* cmakeMakeProgram = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||
std::cout << "CMake Make program is: " << cmakeMakeProgram << std::endl;
|
||||
std::string buildCommand = gen->GenerateBuildCommand(cmakeMakeProgram, cmakeProjectName,
|
||||
0, cmakeBuildConfiguration, true);
|
||||
|
||||
|
@ -78,9 +116,12 @@ bool cmCTestBuildCommand::InitialPass(
|
|||
}
|
||||
|
||||
int res = handler->ProcessHandler();
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
if ( res_var )
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_BUILD(build_dir res)\n"
|
||||
" CTEST_BUILD([BUILD build_dir] [RETURN_VALUE res])\n"
|
||||
"Builds the given build directory and stores results in Build.xml.";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,17 +22,56 @@
|
|||
bool cmCTestConfigureCommand::InitialPass(
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
const char* build_dir = 0;
|
||||
const char* res_var = 0;
|
||||
|
||||
bool havereturn_variable = false;
|
||||
bool havesource = false;
|
||||
for(size_t i=0; i < args.size(); ++i)
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
if ( havereturn_variable )
|
||||
{
|
||||
res_var = args[i].c_str();
|
||||
havereturn_variable = false;
|
||||
}
|
||||
else if ( havesource )
|
||||
{
|
||||
build_dir = args[i].c_str();
|
||||
havesource = false;
|
||||
}
|
||||
else if(args[i] == "RETURN_VALUE")
|
||||
{
|
||||
if ( res_var )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havereturn_variable = true;
|
||||
}
|
||||
else if(args[i] == "BUILD")
|
||||
{
|
||||
if ( build_dir )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
|
||||
return false;
|
||||
}
|
||||
havesource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
|
||||
this->SetError(str.str().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const char* build_dir = args[0].c_str();
|
||||
const char* res_var = args[1].c_str();
|
||||
|
||||
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "ConfigureCommand", "CTEST_CONFIGURE_COMMAND");
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
|
||||
if ( build_dir )
|
||||
{
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* handler = m_CTest->GetHandler("configure");
|
||||
if ( !handler )
|
||||
|
@ -41,9 +80,12 @@ bool cmCTestConfigureCommand::InitialPass(
|
|||
return false;
|
||||
}
|
||||
int res = handler->ProcessHandler();
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
if ( res_var )
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_CONFIGURE(build_dir res)\n"
|
||||
" CTEST_CONFIGURE(BUILD build_dir RETURN_VALUE res)\n"
|
||||
"Configures the given build directory and stores results in Configure.xml. The "
|
||||
"second argument is a variable that will hold return value.";
|
||||
}
|
||||
|
|
|
@ -165,8 +165,8 @@ int cmCTestCoverageHandler::ProcessHandler()
|
|||
cmSystemTools::ConvertToUnixSlashes(sourceDir);
|
||||
cmSystemTools::ConvertToUnixSlashes(binaryDir);
|
||||
|
||||
std::string asfGlob = sourceDir + "/*";
|
||||
std::string abfGlob = binaryDir + "/*";
|
||||
//std::string asfGlob = sourceDir + "/*";
|
||||
//std::string abfGlob = binaryDir + "/*";
|
||||
std::string daGlob = binaryDir + "/*.da";
|
||||
std::string gcovOutputRex = "[0-9]+\\.[0-9]+% of [0-9]+ (source |)lines executed in file (.*)$";
|
||||
std::string gcovOutputRex2 = "^Creating (.*\\.gcov)\\.";
|
||||
|
@ -347,8 +347,8 @@ int cmCTestCoverageHandler::ProcessHandler()
|
|||
int cnt = 0;
|
||||
long total_tested = 0;
|
||||
long total_untested = 0;
|
||||
std::string fullSourceDir = sourceDir + "/";
|
||||
std::string fullBinaryDir = binaryDir + "/";
|
||||
//std::string fullSourceDir = sourceDir + "/";
|
||||
//std::string fullBinaryDir = binaryDir + "/";
|
||||
for ( fileIterator = totalCoverage.begin();
|
||||
fileIterator != totalCoverage.end();
|
||||
++fileIterator )
|
||||
|
|
|
@ -22,13 +22,33 @@
|
|||
bool cmCTestSubmitCommand::InitialPass(
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
if (args.size() != 1)
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
const char* res_var = 0;
|
||||
|
||||
const char* res_var = args[0].c_str();
|
||||
bool havereturn_variable = false;
|
||||
for(size_t i=0; i < args.size(); ++i)
|
||||
{
|
||||
if ( havereturn_variable )
|
||||
{
|
||||
res_var = args[i].c_str();
|
||||
havereturn_variable = false;
|
||||
}
|
||||
else if(args[i] == "RETURN_VALUE")
|
||||
{
|
||||
if ( res_var )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havereturn_variable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
|
||||
this->SetError(str.str().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropMethod", "CTEST_DROP_METHOD");
|
||||
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSite", "CTEST_DROP_SITE");
|
||||
|
@ -45,9 +65,12 @@ bool cmCTestSubmitCommand::InitialPass(
|
|||
return false;
|
||||
}
|
||||
int res = handler->ProcessHandler();
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
if ( res_var )
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_SUBMIT(res)\n"
|
||||
" CTEST_SUBMIT([RETURN_VALUE res])\n"
|
||||
"Submits the test results for the project.";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,16 +22,54 @@
|
|||
bool cmCTestTestCommand::InitialPass(
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
const char* build_dir = 0;
|
||||
const char* res_var = 0;
|
||||
|
||||
bool havereturn_variable = false;
|
||||
bool havesource = false;
|
||||
for(size_t i=0; i < args.size(); ++i)
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
if ( havereturn_variable )
|
||||
{
|
||||
res_var = args[i].c_str();
|
||||
havereturn_variable = false;
|
||||
}
|
||||
else if ( havesource )
|
||||
{
|
||||
build_dir = args[i].c_str();
|
||||
havesource = false;
|
||||
}
|
||||
else if(args[i] == "RETURN_VALUE")
|
||||
{
|
||||
if ( res_var )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havereturn_variable = true;
|
||||
}
|
||||
else if(args[i] == "BUILD")
|
||||
{
|
||||
if ( build_dir )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. BUILD specified twice.");
|
||||
return false;
|
||||
}
|
||||
havesource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
|
||||
this->SetError(str.str().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const char* build_dir = args[0].c_str();
|
||||
const char* res_var = args[1].c_str();
|
||||
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
if ( build_dir )
|
||||
{
|
||||
m_CTest->SetCTestConfiguration("BuildDirectory", build_dir);
|
||||
}
|
||||
|
||||
cmCTestGenericHandler* handler = m_CTest->GetHandler("test");
|
||||
if ( !handler )
|
||||
|
@ -40,12 +78,15 @@ bool cmCTestTestCommand::InitialPass(
|
|||
return false;
|
||||
}
|
||||
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
|
||||
cmSystemTools::ChangeDirectory(build_dir);
|
||||
cmSystemTools::ChangeDirectory(m_CTest->GetCTestConfiguration("BuildDirectory").c_str());
|
||||
int res = handler->ProcessHandler();
|
||||
if ( res_var )
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
}
|
||||
cmSystemTools::ChangeDirectory(current_dir.c_str());
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_TEST(build_dir res)\n"
|
||||
" CTEST_TEST([BUILD build_dir] [RETURN_VALUE res])\n"
|
||||
"Tests the given build directory and stores results in Test.xml. The "
|
||||
"second argument is a variable that will hold value.";
|
||||
}
|
||||
|
|
|
@ -22,14 +22,49 @@
|
|||
bool cmCTestUpdateCommand::InitialPass(
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
if (args.size() != 2)
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments");
|
||||
return false;
|
||||
}
|
||||
const char* source_dir = 0;
|
||||
const char* res_var = 0;
|
||||
|
||||
const char* source_dir = args[0].c_str();
|
||||
const char* res_var = args[1].c_str();
|
||||
bool havereturn_variable = false;
|
||||
bool havesource = false;
|
||||
for(size_t i=0; i < args.size(); ++i)
|
||||
{
|
||||
if ( havereturn_variable )
|
||||
{
|
||||
res_var = args[i].c_str();
|
||||
havereturn_variable = false;
|
||||
}
|
||||
else if ( havesource )
|
||||
{
|
||||
source_dir = args[i].c_str();
|
||||
havesource = false;
|
||||
}
|
||||
else if(args[i] == "RETURN_VALUE")
|
||||
{
|
||||
if ( res_var )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. RETURN_VALUE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havereturn_variable = true;
|
||||
}
|
||||
else if(args[i] == "SOURCE")
|
||||
{
|
||||
if ( source_dir )
|
||||
{
|
||||
this->SetError("called with incorrect number of arguments. SOURCE specified twice.");
|
||||
return false;
|
||||
}
|
||||
havesource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << "called with incorrect number of arguments. Extra argument is: " << args[i].c_str() << ".";
|
||||
this->SetError(str.str().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSCommand", "CTEST_CVS_COMMAND");
|
||||
m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNCommand", "CTEST_SVN_COMMAND");
|
||||
|
@ -40,11 +75,17 @@ bool cmCTestUpdateCommand::InitialPass(
|
|||
this->SetError("internal CTest error. Cannot instantiate update handler");
|
||||
return false;
|
||||
}
|
||||
handler->SetOption("SourceDirectory", source_dir);
|
||||
if ( source_dir )
|
||||
{
|
||||
handler->SetOption("SourceDirectory", source_dir);
|
||||
}
|
||||
int res = handler->ProcessHandler();
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
if ( res_var )
|
||||
{
|
||||
cmOStringStream str;
|
||||
str << res;
|
||||
m_Makefile->AddDefinition(res_var, str.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
virtual const char* GetFullDocumentation()
|
||||
{
|
||||
return
|
||||
" CTEST_UPDATE(source res)\n"
|
||||
" CTEST_UPDATE([SOURCE source] [RETURN_VALUE res])\n"
|
||||
"Updates the given source directory and stores results in Update.xml. The "
|
||||
"second argument is a variable that will hold the number of files "
|
||||
"modified. If there is a problem, the variable will be -1.";
|
||||
|
|
Loading…
Reference in New Issue