diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-17 17:04:56 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-06-17 17:04:56 (GMT) |
commit | d9dc9b54a62c20be2cf42ce050780e1b924e412c (patch) | |
tree | fbc9478d4a3559ec8c6ee5c61a008e031c982f99 /Source | |
parent | d3239ac68f4cc74e5f5c7cecf876f07262bbf57e (diff) | |
download | CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.zip CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.tar.gz CMake-d9dc9b54a62c20be2cf42ce050780e1b924e412c.tar.bz2 |
ENH: Add superclass for all commands and handlers. Improve handlers to have initialization code, and start initializing ctest when start is invoked
Diffstat (limited to 'Source')
26 files changed, 361 insertions, 53 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index aba5f4a..01af294 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -32,6 +32,11 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() } //---------------------------------------------------------------------- +void cmCTestBuildAndTestHandler::Initialize() +{ +} + +//---------------------------------------------------------------------- const char* cmCTestBuildAndTestHandler::GetOutput() { return m_Output.c_str(); diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index 788b28f..3d1f30b 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -31,6 +31,7 @@ class cmake; class cmCTestBuildAndTestHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestBuildAndTestHandler, cmCTestGenericHandler); /* * The main entry point for this class @@ -49,6 +50,8 @@ public: cmCTestBuildAndTestHandler(); + virtual void Initialize(); + protected: ///! Run CMake and build a test and then run it as a single test. int RunCMakeAndTest(std::string* output); diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index ca9d54b..afae26b 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -186,6 +186,64 @@ cmCTestBuildHandler::cmCTestBuildHandler() } } +//---------------------------------------------------------------------- +void cmCTestBuildHandler::Initialize() +{ + m_StartBuild = ""; + m_EndBuild = ""; + m_CustomErrorMatches.clear(); + m_CustomErrorExceptions.clear(); + m_CustomWarningMatches.clear(); + m_CustomWarningExceptions.clear(); + m_ErrorWarningFileLineRegex.clear(); + + m_ErrorMatchRegex.clear(); + m_ErrorExceptionRegex.clear(); + m_WarningMatchRegex.clear(); + m_WarningExceptionRegex.clear(); + m_BuildProcessingQueue.clear(); + m_BuildProcessingQueueLocation = m_BuildProcessingQueue.end(); + m_BuildOutputLogSize = 0; + m_CurrentProcessingLine.clear(); + + m_SimplifySourceDir = ""; + m_SimplifyBuildDir = ""; + m_OutputLineCounter = 0; + m_ErrorsAndWarnings.clear(); + m_LastErrorOrWarning = m_ErrorsAndWarnings.end(); + m_PostContextCount = 0; + m_MaxPreContext = 6; + m_MaxPostContext = 6; + m_PreContext.clear(); + + m_TotalErrors = 0; + m_TotalWarnings = 0; + m_LastTickChar = 0; + + m_ErrorQuotaReached = false; + m_WarningQuotaReached = false; + + m_MaxErrors = 50; + m_MaxWarnings = 50; + + int cc; + for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc ) + { + cmCTestBuildHandler::cmCTestCompileErrorWarningRex r; + if ( r.m_RegularExpression.compile( + cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) ) + { + r.m_FileIndex = cmCTestWarningErrorFileLine[cc].m_FileIndex; + r.m_LineIndex = cmCTestWarningErrorFileLine[cc].m_LineIndex; + m_ErrorWarningFileLineRegex.push_back(r); + } + else + { + cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " + << cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl); + } + } +} //---------------------------------------------------------------------- void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index b949e65..9948300 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -33,6 +33,7 @@ class cmMakefile; class cmCTestBuildHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestBuildHandler, cmCTestGenericHandler); /* * The main entry point for this class @@ -43,6 +44,11 @@ public: void PopulateCustomVectors(cmMakefile *mf); + /** + * Initialize handler + */ + virtual void Initialize(); + private: //! Run command specialized for make and configure. Returns process status // and retVal is return value or exception. diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index f5e8c97..b336f50 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/Source/CTest/cmCTestConfigureHandler.cxx @@ -28,6 +28,10 @@ cmCTestConfigureHandler::cmCTestConfigureHandler() { } +//---------------------------------------------------------------------- +void cmCTestConfigureHandler::Initialize() +{ +} //---------------------------------------------------------------------- //clearly it would be nice if this were broken up into a few smaller diff --git a/Source/CTest/cmCTestConfigureHandler.h b/Source/CTest/cmCTestConfigureHandler.h index e48f088..07d7d7c 100644 --- a/Source/CTest/cmCTestConfigureHandler.h +++ b/Source/CTest/cmCTestConfigureHandler.h @@ -29,6 +29,7 @@ class cmCTestConfigureHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestConfigureHandler, cmCTestGenericHandler); /* * The main entry point for this class @@ -36,6 +37,8 @@ public: int ProcessHandler(); cmCTestConfigureHandler(); + + void Initialize(); }; #endif diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 31b1bb1..915eb8c 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -34,7 +34,11 @@ //---------------------------------------------------------------------- cmCTestCoverageHandler::cmCTestCoverageHandler() { - m_CTest = 0; +} + +//---------------------------------------------------------------------- +void cmCTestCoverageHandler::Initialize() +{ } //---------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h index fc11df6..c2a686d 100644 --- a/Source/CTest/cmCTestCoverageHandler.h +++ b/Source/CTest/cmCTestCoverageHandler.h @@ -31,6 +31,7 @@ class cmGeneratedFileStream; class cmCTestCoverageHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestCoverageHandler, cmCTestGenericHandler); /* * The main entry point for this class @@ -39,6 +40,8 @@ public: cmCTestCoverageHandler(); + virtual void Initialize(); + private: bool ShouldIDoCoverage(const char* file, const char* srcDir, const char* binDir); diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index dccb70f..e2013a1 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -19,7 +19,7 @@ #define cmCTestGenericHandler_h -#include "cmStandardIncludes.h" +#include "cmObject.h" class cmCTest; class cmMakefile; @@ -29,7 +29,7 @@ class cmCTestCommand; * \brief A superclass of all CTest Handlers * */ -class cmCTestGenericHandler +class cmCTestGenericHandler : public cmObject { public: /** @@ -56,6 +56,11 @@ public: const std::vector<std::string>& /*allArgs*/) { return 1; } /** + * Initialize handler + */ + virtual void Initialize() = 0; + + /** * Set the CTest instance */ void SetCTestInstance(cmCTest* ctest) { m_CTest = ctest; } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index a5646c0..7665cba 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -91,6 +91,23 @@ cmCTestMemCheckHandler::cmCTestMemCheckHandler() } //---------------------------------------------------------------------- +void cmCTestMemCheckHandler::Initialize() +{ + this->Superclass::Initialize(); + m_MemoryTester = ""; + m_MemoryTesterOptionsParsed.clear(); + m_MemoryTesterOptions = ""; + m_MemoryTesterStyle = UNKNOWN; + m_MemoryTesterOutputFile = ""; + int cc; + for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ ) + { + m_MemoryTesterGlobalResults[cc] = 0; + } + +} + +//---------------------------------------------------------------------- int cmCTestMemCheckHandler::PreProcessHandler() { if ( !this->InitializeMemoryChecking() ) diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 8ff6a3c..483e2d6 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -31,10 +31,13 @@ class cmMakefile; class cmCTestMemCheckHandler : public cmCTestTestHandler { public: + cmTypeMacro(cmCTestMemCheckHandler, cmCTestTestHandler); + void PopulateCustomVectors(cmMakefile *mf); cmCTestMemCheckHandler(); + void Initialize(); protected: virtual int PreProcessHandler(); virtual int PostProcessHandler(); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 2a408b1..f71983f 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -97,6 +97,49 @@ cmCTestScriptHandler::cmCTestScriptHandler() m_ContinuousDuration = -1; } +//---------------------------------------------------------------------- +void cmCTestScriptHandler::Initialize() +{ + m_Backup = false; + m_EmptyBinDir = false; + m_EmptyBinDirOnce = false; + + m_SourceDir = ""; + m_BinaryDir = ""; + m_BackupSourceDir = ""; + m_BackupBinaryDir = ""; + m_CTestRoot = ""; + m_CVSCheckOut = ""; + m_CTestCmd = ""; + m_CVSCmd = ""; + m_CTestEnv = ""; + m_InitCache = ""; + m_CMakeCmd = ""; + m_CMOutFile = ""; + m_ExtraUpdates.clear(); + + m_MinimumInterval = 20*60; + m_ContinuousDuration = -1; + + // what time in seconds did this script start running + m_ScriptStartTime = 0; + + m_Makefile = 0; + if (m_LocalGenerator) + { + delete m_LocalGenerator; + } + m_LocalGenerator = 0; + if (m_GlobalGenerator) + { + delete m_GlobalGenerator; + } + m_GlobalGenerator = 0; + if (m_CMake) + { + delete m_CMake; + } +} //---------------------------------------------------------------------- cmCTestScriptHandler::~cmCTestScriptHandler() diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 3b7a882..94cb03a 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -66,6 +66,7 @@ class cmCTestCommand; class cmCTestScriptHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestScriptHandler, cmCTestGenericHandler); /** * Add a script to run @@ -97,6 +98,7 @@ public: cmCTestScriptHandler(); ~cmCTestScriptHandler(); + void Initialize(); private: // reads in a script int ReadInScript(const std::string& total_script_arg); diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index d3d3648..7b6645b 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -64,6 +64,7 @@ bool cmCTestStartCommand::InitialPass( this->SetError("binary directory not specified. Specify binary directory as an argument or set CTEST_BINARY_DIRECTORY"); return false; } + m_CTest->EmptyCTestConfiguration(); m_CTest->SetCTestConfiguration("SourceDirectory", src_dir); m_CTest->SetCTestConfiguration("BuildDirectory", bld_dir); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 930da22..1471660 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -68,6 +68,17 @@ cmCTestSubmitHandler::cmCTestSubmitHandler() : m_HTTPProxy(), m_FTPProxy() } //---------------------------------------------------------------------------- +void cmCTestSubmitHandler::Initialize() +{ + m_HTTPProxy = ""; + m_HTTPProxyType = 0; + m_HTTPProxyAuth = ""; + m_FTPProxy = ""; + m_FTPProxyType = 0; + m_LogFile = 0; +} + +//---------------------------------------------------------------------------- bool cmCTestSubmitHandler::SubmitUsingFTP(const cmStdString& localprefix, const std::vector<cmStdString>& files, const cmStdString& remoteprefix, diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 45d8f30..804710f 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -28,6 +28,8 @@ class cmCTestSubmitHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestSubmitHandler, cmCTestGenericHandler); + cmCTestSubmitHandler(); ~cmCTestSubmitHandler() { m_LogFile = 0; } @@ -36,6 +38,7 @@ public: */ int ProcessHandler(); + void Initialize(); private: void SetLogFile(std::ostream* ost) { m_LogFile = ost; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index d84469d..7bd0345 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -294,6 +294,35 @@ cmCTestTestHandler::cmCTestTestHandler() } //---------------------------------------------------------------------- +void cmCTestTestHandler::Initialize() +{ + m_ElapsedTestingTime = -1; + + m_TestResults.clear(); + + m_CustomTestsIgnore.clear(); + m_StartTest = ""; + m_EndTest = ""; + + m_CustomPreTest.clear(); + m_CustomPostTest.clear(); + m_CustomMaximumPassedTestOutputSize = 1 * 1024; + m_CustomMaximumFailedTestOutputSize = 300 * 1024; + + m_TestsToRun.clear(); + + m_UseIncludeRegExp = false; + m_UseExcludeRegExp = false; + m_UseExcludeRegExpFirst = false; + m_IncludeRegExp = ""; + m_ExcludeRegExp = ""; + + TestsToRunString = ""; + m_UseUnion = false; + m_TestList.clear(); +} + +//---------------------------------------------------------------------- void cmCTestTestHandler::PopulateCustomVectors(cmMakefile *mf) { cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_TEST", diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 3076f4d..0a716f7 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -31,6 +31,7 @@ class cmMakefile; class cmCTestTestHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestTestHandler, cmCTestGenericHandler); /** * The main entry point for this class @@ -81,6 +82,8 @@ public: int m_TestCount; }; + void Initialize(); + protected: struct cmCTestTestProperties { diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx index 15b9e90..50030d9 100644 --- a/Source/CTest/cmCTestUpdateCommand.cxx +++ b/Source/CTest/cmCTestUpdateCommand.cxx @@ -66,6 +66,7 @@ bool cmCTestUpdateCommand::InitialPass( } } + m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "UpdateCommand", "CTEST_UPDATE_COMMAND"); m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "CVSCommand", "CTEST_CVS_COMMAND"); m_CTest->SetCTestConfigurationFromCMakeVariable(m_Makefile, "SVNCommand", "CTEST_SVN_COMMAND"); diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 4758436..10856d3 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -39,6 +39,23 @@ #include <float.h> //---------------------------------------------------------------------- +static const char* cmCTestUpdateHandlerUpdateStrings[] = +{ + "Unknown", + "CVS", + "SVN" +}; + +static const char* cmCTestUpdateHandlerUpdateToString(int type) +{ + if ( type < cmCTestUpdateHandler::e_UNKNOWN || type >= cmCTestUpdateHandler::e_LAST ) + { + return cmCTestUpdateHandlerUpdateStrings[cmCTestUpdateHandler::e_UNKNOWN]; + } + return cmCTestUpdateHandlerUpdateStrings[type]; +} + +//---------------------------------------------------------------------- //********************************************************************** class cmCTestUpdateHandlerSVNXMLParser : public cmXMLParser { @@ -156,14 +173,20 @@ private: //---------------------------------------------------------------------- cmCTestUpdateHandler::cmCTestUpdateHandler() { - m_CTest = 0; +} + +//---------------------------------------------------------------------- +void cmCTestUpdateHandler::Initialize() +{ } //---------------------------------------------------------------------- int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) { + cmCTestLog(m_CTest, DEBUG, "Determine update type from command: " << cmd << " and type: " << type << std::endl); if ( type && *type ) { + cmCTestLog(m_CTest, DEBUG, "Type specified: " << type << std::endl); std::string stype = cmSystemTools::LowerCase(type); if ( stype.find("cvs") != std::string::npos ) { @@ -176,6 +199,7 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) } else { + cmCTestLog(m_CTest, DEBUG, "Type not specified, check command: " << cmd << std::endl); std::string stype = cmSystemTools::LowerCase(cmd); if ( stype.find("cvs") != std::string::npos ) { @@ -186,7 +210,20 @@ int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) return cmCTestUpdateHandler::e_SVN; } } - return cmCTestUpdateHandler::e_CVS; + std::string sourceDirectory = this->GetOption("SourceDirectory"); + cmCTestLog(m_CTest, DEBUG, "Check directory: " << sourceDirectory.c_str() << std::endl); + sourceDirectory += "/.svn"; + if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) + { + return cmCTestUpdateHandler::e_SVN; + } + sourceDirectory = this->GetOption("SourceDirectory"); + sourceDirectory += "/CVS"; + if ( cmSystemTools::FileExists(sourceDirectory.c_str()) ) + { + return cmCTestUpdateHandler::e_CVS; + } + return cmCTestUpdateHandler::e_UNKNOWN; } //---------------------------------------------------------------------- @@ -285,6 +322,8 @@ int cmCTestUpdateHandler::ProcessHandler() updateType = this->DetermineType(updateCommand.c_str(), m_CTest->GetCTestConfiguration("UpdateType").c_str()); } + cmCTestLog(m_CTest, HANDLER_OUTPUT, " Use " << cmCTestUpdateHandlerUpdateToString(updateType) << " repository type" << std::endl;); + // And update options std::string updateOptions = m_CTest->GetCTestConfiguration("UpdateOptions"); if ( updateOptions.empty() ) @@ -434,6 +473,7 @@ int cmCTestUpdateHandler::ProcessHandler() &retVal, sourceDirectory, 0 /*m_TimeOut*/); ofs << " Output: " << partialOutput.c_str() << std::endl; ofs << " Errors: " << errors.c_str() << std::endl; + goutput = partialOutput; command = updateCommand + " status"; ofs << "* Status repository: " << std::endl; ofs << " Command: " << command.c_str() << std::endl; @@ -443,6 +483,7 @@ int cmCTestUpdateHandler::ProcessHandler() ofs << " Errors: " << errors.c_str() << std::endl; goutput += partialOutput; res = res && res1; + ofs << " Total output of update: " << goutput.c_str() << std::endl; } } if ( ofs ) @@ -467,7 +508,9 @@ int cmCTestUpdateHandler::ProcessHandler() << m_CTest->GetTestModelString() << "</BuildStamp>" << std::endl; os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n" << "\t<UpdateCommand>" << m_CTest->MakeXMLSafe(command) - << "</UpdateCommand>\n"; + << "</UpdateCommand>\n" + << "\t<UpdateType>" << m_CTest->MakeXMLSafe(cmCTestUpdateHandlerUpdateToString(updateType)) + << "</UpdateType>\n"; // Even though it failed, we may have some useful information. Try to continue... std::vector<cmStdString> lines; @@ -503,7 +546,11 @@ int cmCTestUpdateHandler::ProcessHandler() } } } - if ( updateType == cmCTestUpdateHandler::e_SVN ) + if ( svn_latest_revision <= 0 ) + { + cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem determining the current revision of the repository from output:" << std::endl << goutput.c_str() << std::endl); + } + else if ( updateType == cmCTestUpdateHandler::e_SVN ) { cmCTestLog(m_CTest, HANDLER_OUTPUT, " Current revision of repository is: " << svn_latest_revision << std::endl); } diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 019ee57..bcef45e 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -33,6 +33,7 @@ class cmCTestUpdateHandler : public cmCTestGenericHandler { public: + cmTypeMacro(cmCTestUpdateHandler, cmCTestGenericHandler); /* * The main entry point for this class @@ -42,9 +43,16 @@ public: cmCTestUpdateHandler(); enum { + e_UNKNOWN = 0, e_CVS, - e_SVN + e_SVN, + e_LAST }; + + /** + * Initialize handler + */ + virtual void Initialize(); private: // Some structures needed for update diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b782cd3..f3ff289 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1800,6 +1800,12 @@ std::string cmCTest::GetCTestConfiguration(const char *name) } //---------------------------------------------------------------------- +void cmCTest::EmptyCTestConfiguration() +{ + m_CTestConfiguration.clear(); +} + +//---------------------------------------------------------------------- void cmCTest::SetCTestConfiguration(const char *name, const char* value) { if ( !name ) diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 4d77a95..bd7d74b 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -114,6 +114,7 @@ public: static std::string CleanString(const std::string& str); std::string GetCTestConfiguration(const char *name); void SetCTestConfiguration(const char *name, const char* value); + void EmptyCTestConfiguration(); /** * constructor and destructor diff --git a/Source/cmCommand.h b/Source/cmCommand.h index d26eea5..0143047 100644 --- a/Source/cmCommand.h +++ b/Source/cmCommand.h @@ -17,6 +17,7 @@ #ifndef cmCommand_h #define cmCommand_h +#include "cmObject.h" #include "cmListFileCache.h" #include "cmMakefile.h" @@ -30,9 +31,11 @@ * to support such features as enable/disable, inheritance, * documentation, and construction. */ -class cmCommand +class cmCommand : public cmObject { public: + cmTypeMacro(cmCommand, cmObject); + /** * Construct the command. By default it is enabled with no makefile. */ @@ -104,11 +107,6 @@ public: virtual const char* GetName() = 0; /** - * The class name of the command. - */ - virtual const char* GetNameOfClass() = 0; - - /** * Succinct documentation. */ virtual const char* GetTerseDocumentation() = 0; @@ -156,19 +154,6 @@ public: } /** - * Returns true if this class is the given class, or a subclass of it. - */ - static bool IsTypeOf(const char *type) - { return !strcmp("cmCommand", type); } - - /** - * Returns true if this object is an instance of the given class or - * a subclass of it. - */ - virtual bool IsA(const char *type) - { return cmCommand::IsTypeOf(type); } - - /** * Set the error message */ void SetError(const char* e) @@ -186,30 +171,4 @@ private: std::string m_Error; }; -// All subclasses of cmCommand should invoke this macro. -#define cmTypeMacro(thisClass,superclass) \ -virtual const char* GetNameOfClass() { return #thisClass; } \ -typedef superclass Superclass; \ -static bool IsTypeOf(const char *type) \ -{ \ - if ( !strcmp(#thisClass,type) ) \ - { \ - return true; \ - } \ - return Superclass::IsTypeOf(type); \ -} \ -virtual bool IsA(const char *type) \ -{ \ - return thisClass::IsTypeOf(type); \ -} \ -static thisClass* SafeDownCast(cmCommand *c) \ -{ \ - if ( c && c->IsA(#thisClass) ) \ - { \ - return (thisClass *)c; \ - } \ - return 0;\ -} - - #endif diff --git a/Source/cmObject.h b/Source/cmObject.h new file mode 100644 index 0000000..99ab31d --- /dev/null +++ b/Source/cmObject.h @@ -0,0 +1,56 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#ifndef cmObject_h +#define cmObject_h + +#include "cmStandardIncludes.h" + +/** \class cmObject + * \brief Superclass for all commands and other classes in CMake. + * + * cmObject is the base class for all classes in CMake. It defines some methods + * such as GetNameOfClass, IsA, SafeDownCast. + */ +class cmObject +{ +public: + /** + * Need virtual destructor to destroy real command type. + */ + virtual ~cmObject() {} + + /** + * The class name of the command. + */ + virtual const char* GetNameOfClass() = 0; + + /** + * Returns true if this class is the given class, or a subclass of it. + */ + static bool IsTypeOf(const char *type) + { return !strcmp("cmObject", type); } + + /** + * Returns true if this object is an instance of the given class or + * a subclass of it. + */ + virtual bool IsA(const char *type) + { return cmObject::IsTypeOf(type); } +}; + +#endif + diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index ae83332..70d2048 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -323,4 +323,31 @@ public: # pragma reset woff 1375 /* base class destructor not virtual */ #endif +// All subclasses of cmCommand or cmCTestGenericHandler should invoke this macro. +#define cmTypeMacro(thisClass,superclass) \ +virtual const char* GetNameOfClass() { return #thisClass; } \ +typedef superclass Superclass; \ +static bool IsTypeOf(const char *type) \ +{ \ + if ( !strcmp(#thisClass,type) ) \ + { \ + return true; \ + } \ + return Superclass::IsTypeOf(type); \ +} \ +virtual bool IsA(const char *type) \ +{ \ + return thisClass::IsTypeOf(type); \ +} \ +static thisClass* SafeDownCast(cmObject *c) \ +{ \ + if ( c && c->IsA(#thisClass) ) \ + { \ + return (thisClass *)c; \ + } \ + return 0;\ +} + + + #endif |