diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 61 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.cxx | 62 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureCommand.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 8 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 39 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.cxx | 63 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateCommand.cxx | 61 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateCommand.h | 2 |
11 files changed, 246 insertions, 58 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 0f9b309..d8f1ef7 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -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; } diff --git a/Source/CTest/cmCTestBuildCommand.h b/Source/CTest/cmCTestBuildCommand.h index 82f87a4..4284a08 100644 --- a/Source/CTest/cmCTestBuildCommand.h +++ b/Source/CTest/cmCTestBuildCommand.h @@ -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."; } diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 7fd1e50..2925cad 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -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; } diff --git a/Source/CTest/cmCTestConfigureCommand.h b/Source/CTest/cmCTestConfigureCommand.h index bd7c00c..8508898 100644 --- a/Source/CTest/cmCTestConfigureCommand.h +++ b/Source/CTest/cmCTestConfigureCommand.h @@ -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."; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index f5872ea..de42576 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -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 ) diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 72fccb8..4e0d74a 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -22,14 +22,34 @@ bool cmCTestSubmitCommand::InitialPass( std::vector<std::string> const& args) { - if (args.size() != 1) + const char* res_var = 0; + + bool havereturn_variable = 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(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; + } } - const char* res_var = args[0].c_str(); - m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropMethod", "CTEST_DROP_METHOD"); m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropSite", "CTEST_DROP_SITE"); m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "DropLocation", "CTEST_DROP_LOCATION"); @@ -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; } diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index e71d34c..8eb0771 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -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."; } diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index c0a48f3..38b7051 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -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; } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 907cb54..c0e6bf3 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -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."; } diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index d8ba866..c0e00ae 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -22,15 +22,50 @@ bool cmCTestUpdateCommand::InitialPass( std::vector<std::string> const& args) { - if (args.size() != 2) + const char* source_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 ) + { + 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; + } } - const char* source_dir = args[0].c_str(); - const char* res_var = args[1].c_str(); - 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; } diff --git a/Source/CTest/cmCTestUpdateCommand.h b/Source/CTest/cmCTestUpdateCommand.h index ace980e..543e4b5 100644 --- a/Source/CTest/cmCTestUpdateCommand.h +++ b/Source/CTest/cmCTestUpdateCommand.h @@ -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."; |