diff options
-rw-r--r-- | Source/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.h | 15 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestConfigureHandler.h | 18 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.h | 14 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.cxx | 25 | ||||
-rw-r--r-- | Source/CTest/cmCTestGenericHandler.h | 60 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 25 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.h | 17 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 15 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.h | 16 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 21 |
16 files changed, 137 insertions, 114 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5cb9b6e..9926525 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -139,6 +139,7 @@ ADD_EXECUTABLE(cmake cmakemain.cxx) ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation) SET(CMTEST_SRCS ctest.cxx cmCTest.cxx + CTest/cmCTestGenericHandler.cxx CTest/cmCTestBuildHandler.cxx CTest/cmCTestConfigureHandler.cxx CTest/cmCTestCoverageHandler.cxx diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 1c40b23..24a57a2 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -156,8 +156,6 @@ cmCTestWarningErrorFileLine[] = { //---------------------------------------------------------------------- cmCTestBuildHandler::cmCTestBuildHandler() { - m_Verbose = false; - m_CTest = 0; int cc; for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc ) { @@ -194,10 +192,8 @@ void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf) //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... -int cmCTestBuildHandler::BuildDirectory(cmCTest *ctest_inst) +int cmCTestBuildHandler::BuildDirectory() { - m_CTest = ctest_inst; - std::cout << "Build project" << std::endl; std::string makeCommand = m_CTest->GetDartConfiguration("MakeCommand"); if ( makeCommand.size() == 0 ) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index a5dc57a..9a6b15a 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -19,31 +19,25 @@ #define cmCTestBuildHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" #include <cmsys/RegularExpression.hxx> -class cmCTest; class cmMakefile; /** \class cmCTestBuildHandler * \brief A class that handles ctest -S invocations * */ -class cmCTestBuildHandler +class cmCTestBuildHandler : public cmCTestGenericHandler { public: /* * The main entry point for this class */ - int BuildDirectory(cmCTest *); - - /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } + int BuildDirectory(); cmCTestBuildHandler(); @@ -77,9 +71,6 @@ private: double elapsed_time); - bool m_Verbose; - cmCTest *m_CTest; - std::string m_StartBuild; std::string m_EndBuild; diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index fbf88b4..dc70768 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -34,10 +34,8 @@ cmCTestConfigureHandler::cmCTestConfigureHandler() //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... -int cmCTestConfigureHandler::ConfigureDirectory(cmCTest *ctest_inst) +int cmCTestConfigureHandler::ConfigureDirectory() { - m_CTest = ctest_inst; - std::cout << "Configure project" << std::endl; std::string cCommand = m_CTest->GetDartConfiguration("ConfigureCommand"); if ( cCommand.size() == 0 ) diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index 5a66c1a..c475d6d 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -19,35 +19,23 @@ #define cmCTestConfigureHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" -class cmCTest; - /** \class cmCTestConfigureHandler * \brief A class that handles ctest -S invocations * */ -class cmCTestConfigureHandler +class cmCTestConfigureHandler : public cmCTestGenericHandler { public: /* * The main entry point for this class */ - int ConfigureDirectory(cmCTest *); - - /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } + int ConfigureDirectory(); cmCTestConfigureHandler(); - -private: - bool m_Verbose; - cmCTest *m_CTest; - }; #endif diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 8883b39..4f7a42e 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -154,10 +154,8 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* src //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... -int cmCTestCoverageHandler::CoverageDirectory(cmCTest *ctest_inst) +int cmCTestCoverageHandler::CoverageDirectory() { - m_CTest = ctest_inst; - int error = 0; std::string sourceDir = m_CTest->GetDartConfiguration("SourceDirectory"); diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index c6a80a6..1c5aaf6 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -19,35 +19,27 @@ #define cmCTestCoverageHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" -class cmCTest; class cmGeneratedFileStream; /** \class cmCTestCoverageHandler * \brief A class that handles coverage computaiton for ctest * */ -class cmCTestCoverageHandler +class cmCTestCoverageHandler : public cmCTestGenericHandler { public: /* * The main entry point for this class */ - int CoverageDirectory(cmCTest *); - - /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } + int CoverageDirectory(); cmCTestCoverageHandler(); private: - bool m_Verbose; - cmCTest *m_CTest; bool ShouldIDoCoverage(const char* file, const char* srcDir, const char* binDir, bool verbose); bool StartLogFile(cmGeneratedFileStream& ostr, int logFileCount); diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx new file mode 100644 index 0000000..10d4f94 --- /dev/null +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -0,0 +1,25 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#include "cmCTestGenericHandler.h" + +cmCTestGenericHandler::cmCTestGenericHandler() +{ + m_Verbose = false; + m_CTest = 0; +} + diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h new file mode 100644 index 0000000..56105a5 --- /dev/null +++ b/Source/CTest/cmCTestGenericHandler.h @@ -0,0 +1,60 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef cmCTestGenericHandler_h +#define cmCTestGenericHandler_h + + +#include "cmStandardIncludes.h" + +class cmCTest; +class cmMakefile; + +/** \class cmCTestGenericHandler + * \brief A superclass of all CTest Handlers + * + */ +class cmCTestGenericHandler +{ +public: + /** + * If verbose then more informaiton is printed out + */ + void SetVerbose(bool val) { m_Verbose = val; } + + /** + * Populate internals from CTest custom scripts + */ + void PopulateCustomVectors(cmMakefile *) {} + + /** + * Set the CTest instance + */ + void SetCTestInstance(cmCTest* ctest) { m_CTest = ctest; } + + /** + * Construct handler + */ + cmCTestGenericHandler(); + +protected: + bool m_Verbose; + cmCTest *m_CTest; +}; + +#endif + diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 410d11d..f197722 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -125,7 +125,7 @@ void cmCTestScriptHandler::AddConfigurationScript(const char *script) //---------------------------------------------------------------------- // the generic entry point for handling scripts, this routine will run all // the scripts provides a -S arguments -int cmCTestScriptHandler::RunConfigurationScript(cmCTest* ctest) +int cmCTestScriptHandler::RunConfigurationScript() { int res = 0; std::vector<cmStdString>::iterator it; @@ -134,7 +134,7 @@ int cmCTestScriptHandler::RunConfigurationScript(cmCTest* ctest) it ++ ) { // for each script run it - res += this->RunConfigurationScript(ctest, + res += this->RunConfigurationScript( cmSystemTools::CollapseFullPath(it->c_str())); } return res; @@ -157,8 +157,7 @@ void cmCTestScriptHandler::UpdateElapsedTime() //---------------------------------------------------------------------- // this sets up some variables for thew script to use, creates the required // cmake instance and generators, and then reads in the script -int cmCTestScriptHandler::ReadInScript(cmCTest* ctest, - const std::string& total_script_arg) +int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) { // if the argument has a , in it then it needs to be broken into the fist // argument (which is the script) and the second argument which will be @@ -201,7 +200,7 @@ int cmCTestScriptHandler::ReadInScript(cmCTest* ctest, cmSystemTools::GetFilenameName( script).c_str()); m_LocalGenerator->GetMakefile()->AddDefinition("CTEST_EXECUTABLE_NAME", - ctest->GetCTestExecutable()); + m_CTest->GetCTestExecutable()); this->UpdateElapsedTime(); @@ -209,15 +208,15 @@ int cmCTestScriptHandler::ReadInScript(cmCTest* ctest, // for ctest commands to clean this up. If a couple more commands are // created with the same format lets do that - ken cmCTestCommand* newCom = new cmCTestRunScriptCommand; - newCom->m_CTest = ctest; + newCom->m_CTest = m_CTest; newCom->m_CTestScriptHandler = this; m_CMake->AddCommand(newCom); newCom = new cmCTestEmptyBinaryDirectoryCommand; - newCom->m_CTest = ctest; + newCom->m_CTest = m_CTest; newCom->m_CTestScriptHandler = this; m_CMake->AddCommand(newCom); newCom = new cmCTestSleepCommand; - newCom->m_CTest = ctest; + newCom->m_CTest = m_CTest; newCom->m_CTestScriptHandler = this; m_CMake->AddCommand(newCom); @@ -349,8 +348,7 @@ void cmCTestScriptHandler::SleepInSeconds(unsigned int secondsToWait) //---------------------------------------------------------------------- // run a specific script -int cmCTestScriptHandler::RunConfigurationScript(cmCTest* ctest, - const std::string& total_script_arg) +int cmCTestScriptHandler::RunConfigurationScript(const std::string& total_script_arg) { int result; @@ -358,7 +356,7 @@ int cmCTestScriptHandler::RunConfigurationScript(cmCTest* ctest, cmSystemTools::GetTime(); // read in the script - result = this->ReadInScript(ctest, total_script_arg); + result = this->ReadInScript(total_script_arg); if (result) { return result; @@ -761,11 +759,12 @@ void cmCTestScriptHandler::RestoreBackupDirectories() } } -bool cmCTestScriptHandler::RunScript(cmCTest *ctest, const char *sname) +bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char *sname) { cmCTestScriptHandler* sh = new cmCTestScriptHandler(); + sh->SetCTestInstance(ctest); sh->AddConfigurationScript(sname); - sh->RunConfigurationScript(ctest); + sh->RunConfigurationScript(); delete sh; return true; } diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 4c2eb83..0c0b30a 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -19,14 +19,13 @@ #define cmCTestScriptHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" class cmMakefile; class cmLocalGenerator; class cmGlobalGenerator; class cmake; -class cmCTest; /** \class cmCTestScriptHandler * \brief A class that handles ctest -S invocations @@ -63,7 +62,7 @@ class cmCTest; * CTEST_SCRIPT_NAME * */ -class cmCTestScriptHandler +class cmCTestScriptHandler : public cmCTestGenericHandler { public: @@ -75,12 +74,7 @@ public: /** * Run a dashboard using a specified confiuration script */ - int RunConfigurationScript(cmCTest* ctest); - - /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } + int RunConfigurationScript(); /* * Run a script @@ -104,7 +98,7 @@ public: private: // reads in a script - int ReadInScript(cmCTest* ctest, const std::string& total_script_arg); + int ReadInScript(const std::string& total_script_arg); // extract vars from the script to set ivars int ExtractVariables(); @@ -119,12 +113,11 @@ private: int BackupDirectories(); void RestoreBackupDirectories(); - int RunConfigurationScript(cmCTest* ctest, const std::string& script); + int RunConfigurationScript(const std::string& script); int RunConfigurationDashboard(); std::vector<cmStdString> m_ConfigurationScripts; - bool m_Verbose; bool m_Backup; bool m_EmptyBinDir; bool m_EmptyBinDirOnce; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9e8945b..3766a1e 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -192,8 +192,6 @@ inline int GetNextRealNumber(std::string const& in, //---------------------------------------------------------------------- cmCTestTestHandler::cmCTestTestHandler() { - m_Verbose = false; - m_CTest = 0; m_UseUnion = false; m_UseIncludeRegExp = false; @@ -234,10 +232,8 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile *mf) //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... -int cmCTestTestHandler::TestDirectory(cmCTest *ctest_inst, bool memcheck) +int cmCTestTestHandler::TestDirectory(bool memcheck) { - m_CTest = ctest_inst; - m_TestResults.clear(); std::cout << (memcheck ? "Memory check" : "Test") << " project" << std::endl; if ( memcheck ) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 1c417a2..e938a23 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -19,31 +19,25 @@ #define cmCTestTestHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" -class cmCTest; class cmMakefile; /** \class cmCTestTestHandler * \brief A class that handles ctest -S invocations * */ -class cmCTestTestHandler +class cmCTestTestHandler : public cmCTestGenericHandler { public: /* * The main entry point for this class */ - int TestDirectory(cmCTest *, bool memcheck); + int TestDirectory(bool memcheck); /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } - - /* * When both -R and -I are used should te resulting test list be the * intersection or the union of the lists. By default it is the * intersection. @@ -114,9 +108,6 @@ private: COMPLETED }; - bool m_Verbose; - cmCTest *m_CTest; - std::string m_MemoryTester; std::vector<cmStdString> m_MemoryTesterOptionsParsed; std::string m_MemoryTesterOptions; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index cbdb3ad..5054e04 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -49,10 +49,8 @@ cmCTestUpdateHandler::cmCTestUpdateHandler() //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller //functions and commented... -int cmCTestUpdateHandler::UpdateDirectory(cmCTest *ctest_inst) +int cmCTestUpdateHandler::UpdateDirectory() { - m_CTest = ctest_inst; - int count = 0; std::string::size_type cc, kk; std::string cvsCommand = m_CTest->GetDartConfiguration("CVSCommand"); diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 14ef61c..3528eda 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -19,35 +19,25 @@ #define cmCTestUpdateHandler_h -#include "cmStandardIncludes.h" +#include "cmCTestGenericHandler.h" #include "cmListFileCache.h" -class cmCTest; - /** \class cmCTestUpdateHandler * \brief A class that handles ctest -S invocations * */ -class cmCTestUpdateHandler +class cmCTestUpdateHandler : public cmCTestGenericHandler { public: /* * The main entry point for this class */ - int UpdateDirectory(cmCTest *); - - /* - * If verbose then more informaiton is printed out - */ - void SetVerbose(bool val) { m_Verbose = val; } + int UpdateDirectory(); cmCTestUpdateHandler(); private: - bool m_Verbose; - cmCTest *m_CTest; - // Some structures needed for cvs update struct StringPair : public std::pair<std::string, std::string>{}; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index daa05c0..41d5d89 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -246,6 +246,13 @@ cmCTest::cmCTest() this->TestHandler = new cmCTestTestHandler; this->UpdateHandler = new cmCTestUpdateHandler; this->ConfigureHandler = new cmCTestConfigureHandler; + + this->BuildHandler->SetCTestInstance(this); + this->CoverageHandler->SetCTestInstance(this); + this->ScriptHandler->SetCTestInstance(this); + this->TestHandler->SetCTestInstance(this); + this->UpdateHandler->SetCTestInstance(this); + this->ConfigureHandler->SetCTestInstance(this); } cmCTest::~cmCTest() @@ -720,7 +727,7 @@ int cmCTest::ProcessTests() } if ( m_Tests[UPDATE_TEST] || m_Tests[ALL_TEST] ) { - update_count = this->UpdateHandler->UpdateDirectory(this); + update_count = this->UpdateHandler->UpdateDirectory(); if ( update_count < 0 ) { res |= cmCTest::UPDATE_ERRORS; @@ -732,7 +739,7 @@ int cmCTest::ProcessTests() } if ( m_Tests[CONFIGURE_TEST] || m_Tests[ALL_TEST] ) { - if (this->ConfigureHandler->ConfigureDirectory(this)) + if (this->ConfigureHandler->ConfigureDirectory()) { res |= cmCTest::CONFIGURE_ERRORS; } @@ -740,7 +747,7 @@ int cmCTest::ProcessTests() if ( m_Tests[BUILD_TEST] || m_Tests[ALL_TEST] ) { this->UpdateCTestConfiguration(); - if (this->BuildHandler->BuildDirectory(this)) + if (this->BuildHandler->BuildDirectory()) { res |= cmCTest::BUILD_ERRORS; } @@ -748,7 +755,7 @@ int cmCTest::ProcessTests() if ( m_Tests[TEST_TEST] || m_Tests[ALL_TEST] || notest ) { this->UpdateCTestConfiguration(); - if (this->TestHandler->TestDirectory(this,false)) + if (this->TestHandler->TestDirectory(false)) { res |= cmCTest::TEST_ERRORS; } @@ -756,7 +763,7 @@ int cmCTest::ProcessTests() if ( m_Tests[COVERAGE_TEST] || m_Tests[ALL_TEST] ) { this->UpdateCTestConfiguration(); - if (this->CoverageHandler->CoverageDirectory(this)) + if (this->CoverageHandler->CoverageDirectory()) { res |= cmCTest::COVERAGE_ERRORS; } @@ -764,7 +771,7 @@ int cmCTest::ProcessTests() if ( m_Tests[MEMCHECK_TEST] || m_Tests[ALL_TEST] ) { this->UpdateCTestConfiguration(); - if (this->TestHandler->TestDirectory(this,true)) + if (this->TestHandler->TestDirectory(true)) { res |= cmCTest::MEMORY_ERRORS; } @@ -1600,7 +1607,7 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output) // call process directory if (this->m_RunConfigurationScript) { - res = this->ScriptHandler->RunConfigurationScript(this); + res = this->ScriptHandler->RunConfigurationScript(); } else { |