diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-02-17 15:51:52 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-02-17 15:51:52 (GMT) |
commit | 8fe168651033cb1374b36424ed2458db5d56ab27 (patch) | |
tree | d39ea4af235887acd1f907cb2d1a2948273e6307 /Source/CTest | |
parent | ad5115d00f4753970187739c20360d922b36e7b1 (diff) | |
download | CMake-8fe168651033cb1374b36424ed2458db5d56ab27.zip CMake-8fe168651033cb1374b36424ed2458db5d56ab27.tar.gz CMake-8fe168651033cb1374b36424ed2458db5d56ab27.tar.bz2 |
ENH: Cleanups and add CTEST_START command
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestCoverageHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 26 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.h | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 78 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.h | 81 |
6 files changed, 179 insertions, 14 deletions
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index b09ac4d..3c7e197 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -176,7 +176,7 @@ int cmCTestCoverageHandler::ProcessHandler() std::string coverage_start_time = m_CTest->CurrentTime(); - std::string testingDir = m_CTest->GetToplevelPath() + "/Testing"; + std::string testingDir = m_CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; std::string currentDirectory = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::MakeDirectory(tempDir.c_str()); diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 73577fc..490236a 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -316,7 +316,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() m_MemoryTesterOptions = m_CTest->GetDartConfiguration("ValgrindCommandOptions"); } - m_MemoryTesterOutputFile = m_CTest->GetToplevelPath() + "/Testing/Temporary/MemoryChecker.log"; + m_MemoryTesterOutputFile = m_CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log"; m_MemoryTesterOutputFile = cmSystemTools::EscapeSpaces(m_MemoryTesterOutputFile.c_str()); if ( m_MemoryTester.find("valgrind") != std::string::npos ) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index d1e89df..ba396ba 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -45,6 +45,7 @@ #include "cmCTestEmptyBinaryDirectoryCommand.h" #include "cmCTestRunScriptCommand.h" #include "cmCTestSleepCommand.h" +#include "cmCTestStartCommand.h" #define CTEST_INITIAL_CMAKE_OUTPUT_FILE_NAME "CTestInitialCMakeOutput.log" @@ -158,6 +159,15 @@ void cmCTestScriptHandler::UpdateElapsedTime() } //---------------------------------------------------------------------- +void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command) +{ + cmCTestCommand* newCom = command; + newCom->m_CTest = m_CTest; + newCom->m_CTestScriptHandler = this; + m_CMake->AddCommand(newCom); +} + +//---------------------------------------------------------------------- // 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(const std::string& total_script_arg) @@ -209,18 +219,10 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) // add any ctest specific commands, probably should have common superclass // 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 = m_CTest; - newCom->m_CTestScriptHandler = this; - m_CMake->AddCommand(newCom); - newCom = new cmCTestEmptyBinaryDirectoryCommand; - newCom->m_CTest = m_CTest; - newCom->m_CTestScriptHandler = this; - m_CMake->AddCommand(newCom); - newCom = new cmCTestSleepCommand; - newCom->m_CTest = m_CTest; - newCom->m_CTestScriptHandler = this; - m_CMake->AddCommand(newCom); + this->AddCTestCommand(new cmCTestRunScriptCommand); + this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand); + this->AddCTestCommand(new cmCTestSleepCommand); + this->AddCTestCommand(new cmCTestStartCommand); // add the script arg if defined if (script_arg.size()) diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h index 4d316ce..3b7a882 100644 --- a/Source/CTest/cmCTestScriptHandler.h +++ b/Source/CTest/cmCTestScriptHandler.h @@ -26,6 +26,7 @@ class cmMakefile; class cmLocalGenerator; class cmGlobalGenerator; class cmake; +class cmCTestCommand; /** \class cmCTestScriptHandler * \brief A class that handles ctest -S invocations @@ -116,6 +117,9 @@ private: int RunConfigurationScript(const std::string& script); int RunConfigurationDashboard(); + // Add ctest command + void AddCTestCommand(cmCTestCommand* command); + std::vector<cmStdString> m_ConfigurationScripts; bool m_Backup; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx new file mode 100644 index 0000000..78938b6 --- /dev/null +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -0,0 +1,78 @@ +/*========================================================================= + + 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 "cmCTestStartCommand.h" + +#include "cmCTest.h" + +bool cmCTestStartCommand::InitialPass( + std::vector<std::string> const& args) +{ + if (args.size() < 1) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + const char* smodel = args[0].c_str(); + const char* src_dir = 0; + const char* bld_dir = 0; + + if ( args.size() >= 2 ) + { + src_dir = args[1].c_str(); + if ( args.size() == 3 ) + { + bld_dir = args[2].c_str(); + } + } + if ( args.size() > 3 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + if ( !src_dir ) + { + src_dir = m_Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"); + } + if ( !bld_dir) + { + bld_dir = m_Makefile->GetDefinition("CTEST_BINARY_DIRECTORY"); + } + if ( !src_dir ) + { + this->SetError("source directory not specified. Specify source directory as an argument or set CTEST_SOURCE_DIRECTORY"); + return false; + } + if ( !bld_dir) + { + this->SetError("binary directory not specified. Specify binary directory as an argument or set CTEST_BINARY_DIRECTORY"); + return false; + } + std::cout << "Run dashboard with model " << smodel + << " for src dir: " << src_dir << " and binary dir: " << bld_dir << std::endl; + + int model = m_CTest->GetTestModelFromString(smodel); + m_CTest->SetTestModel(model); + m_CTest->SetProduceXML(true); + if ( !m_CTest->Initialize(bld_dir) ) + { + return false; + } + return true; +} + + diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h new file mode 100644 index 0000000..2bed7d7 --- /dev/null +++ b/Source/CTest/cmCTestStartCommand.h @@ -0,0 +1,81 @@ +/*========================================================================= + + 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 cmCTestStartCommand_h +#define cmCTestStartCommand_h + +#include "cmCTestCommand.h" + +/** \class cmCTestStart + * \brief Run a ctest script + * + * cmCTestStartCommand defineds the command to start the nightly testing. + */ +class cmCTestStartCommand : public cmCTestCommand +{ +public: + + cmCTestStartCommand() {} + + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + cmCTestStartCommand* ni = new cmCTestStartCommand; + ni->m_CTest = this->m_CTest; + ni->m_CTestScriptHandler = this->m_CTestScriptHandler; + return ni; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector<std::string> const& args); + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() { return "CTEST_START";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Starts the testing for a given model"; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " CTEST_START(Model [source [binary]])\n" + "Starts the testing for a given model. The command should be called after " + "the binary directory is initialized. If the 'source' and 'binary' " + "directory are not specified, it reads the CTEST_SOURCE_DIRECTORY and " + "CTEST_BINARY_DIRECTORY."; + } + + cmTypeMacro(cmCTestStartCommand, cmCTestCommand); + +}; + + +#endif |