Преглед изворни кода

ENH: Add command to read ctest custom files

Andy Cedilnik пре 19 година
родитељ
комит
fce93e890d

+ 39 - 0
Source/CTest/cmCTestReadCustomFilesCommand.cxx

@@ -0,0 +1,39 @@
+/*=========================================================================
+
+  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 "cmCTestReadCustomFilesCommand.h"
+
+#include "cmCTest.h"
+
+bool cmCTestReadCustomFilesCommand::InitialPass(
+  std::vector<std::string> const& args)
+{
+  if (args.size() < 1)
+    {
+    this->SetError("called with incorrect number of arguments");
+    return false;
+    }
+
+  std::vector<std::string>::const_iterator dit;
+  for ( dit = args.begin(); dit != args.end(); ++ dit )
+    {
+    this->CTest->ReadCustomConfigurationFileTree(dit->c_str());
+    }
+  
+  return false;
+}
+
+

+ 79 - 0
Source/CTest/cmCTestReadCustomFilesCommand.h

@@ -0,0 +1,79 @@
+/*=========================================================================
+
+  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 cmCTestReadCustomFilesCommand_h
+#define cmCTestReadCustomFilesCommand_h
+
+#include "cmCTestCommand.h"
+
+/** \class cmCTestReadCustomFiles
+ * \brief Run a ctest script
+ *
+ * cmLibrarysCommand defines a list of executable (i.e., test)
+ * programs to create.
+ */
+class cmCTestReadCustomFilesCommand : public cmCTestCommand
+{
+public:
+
+  cmCTestReadCustomFilesCommand() {}
+  
+  /**
+   * This is a virtual constructor for the command.
+   */
+  virtual cmCommand* Clone() 
+    {
+    cmCTestReadCustomFilesCommand* ni = new cmCTestReadCustomFilesCommand;
+    ni->CTest = this->CTest;
+    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_READ_CUSTOM_FILES";}
+
+  /**
+   * Succinct documentation.
+   */
+  virtual const char* GetTerseDocumentation() 
+    {
+    return "read CTestCustom files.";
+    }
+  
+  /**
+   * More documentation.
+   */
+  virtual const char* GetFullDocumentation()
+    {
+    return
+      "  CTEST_READ_CUSTOM_FILES( directory ... )\n"
+      "Read all the CTestCustom.ctest or CTestCustom.cmake files from the given "
+      "directory.";
+    }
+
+  cmTypeMacro(cmCTestReadCustomFilesCommand, cmCTestCommand);
+
+};
+
+
+#endif

+ 2 - 0
Source/CTest/cmCTestScriptHandler.cxx

@@ -48,6 +48,7 @@
 #include "cmCTestCoverageCommand.h"
 #include "cmCTestEmptyBinaryDirectoryCommand.h"
 #include "cmCTestMemCheckCommand.h"
+#include "cmCTestReadCustomFilesCommand.h"
 #include "cmCTestRunScriptCommand.h"
 #include "cmCTestSleepCommand.h"
 #include "cmCTestStartCommand.h"
@@ -277,6 +278,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
   this->AddCTestCommand(new cmCTestCoverageCommand);
   this->AddCTestCommand(new cmCTestEmptyBinaryDirectoryCommand);
   this->AddCTestCommand(new cmCTestMemCheckCommand);
+  this->AddCTestCommand(new cmCTestReadCustomFilesCommand);
   this->AddCTestCommand(new cmCTestRunScriptCommand);
   this->AddCTestCommand(new cmCTestSleepCommand);
   this->AddCTestCommand(new cmCTestStartCommand);