[cmake-commits] martink committed cmCTestTestHandler.cxx 1.61 1.62

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Jan 18 10:25:28 EST 2008


Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv16939/CTest

Modified Files:
	cmCTestTestHandler.cxx 
Log Message:
BUG: fix bugs 5539 (progress going beyond 100% when new files are added) and 5889 (tests are not found in some cases when using add_subdirectory to .. etc)


Index: cmCTestTestHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestTestHandler.cxx,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cmCTestTestHandler.cxx	17 Jan 2008 17:44:59 -0000	1.61
+++ cmCTestTestHandler.cxx	18 Jan 2008 15:25:25 -0000	1.62
@@ -36,7 +36,7 @@
 #include <memory> // auto_ptr
 
 //----------------------------------------------------------------------
-class cmCTestSubdirCommand : public cmCommand
+class cmCTestAddSubdirectoryCommand : public cmCommand
 {
 public:
   /**
@@ -44,7 +44,7 @@
    */
   virtual cmCommand* Clone()
     {
-    cmCTestSubdirCommand* c = new cmCTestSubdirCommand;
+    cmCTestAddSubdirectoryCommand* c = new cmCTestAddSubdirectoryCommand;
     c->TestHandler = this->TestHandler;
     return c;
     }
@@ -58,65 +58,63 @@
   /**
    * The name of the command as specified in CMakeList.txt.
    */
-  virtual const char* GetName() { return "SUBDIRS";}
+  virtual const char* GetName() { return "add_subdirectory";}
 
   // Unused methods
   virtual const char* GetTerseDocumentation() { return ""; }
   virtual const char* GetFullDocumentation() { return ""; }
 
-  cmTypeMacro(cmCTestSubdirCommand, cmCommand);
+  cmTypeMacro(cmCTestAddSubdirectoryCommand, cmCommand);
 
   cmCTestTestHandler* TestHandler;
 };
 
 //----------------------------------------------------------------------
-bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
+bool cmCTestAddSubdirectoryCommand
+::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 it;
+
   std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
-  for ( it = args.begin(); it != args.end(); ++ it )
-    {
-    cmSystemTools::ChangeDirectory(cwd.c_str());
-    std::string fname = cwd;
-    fname += "/";
-    fname += *it;
+  cmSystemTools::ChangeDirectory(cwd.c_str());
+  std::string fname = cwd;
+  fname += "/";
+  fname += args[1];
 
-    if ( !cmSystemTools::FileExists(fname.c_str()) )
-      {
-      // No subdirectory? So what...
-      continue;
-      }
-    cmSystemTools::ChangeDirectory(fname.c_str());
-    const char* testFilename;
-    if( cmSystemTools::FileExists("CTestTestfile.cmake") )
-      {
-      // does the CTestTestfile.cmake exist ?
-      testFilename = "CTestTestfile.cmake";
-      }
-    else
-      {
-      // No CTestTestfile? Who cares...
-      cmSystemTools::ChangeDirectory(cwd.c_str());
-      continue;
-      }
-    fname += "/";
-    fname += testFilename;
-    bool readit = 
-      this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
-                                   fname.c_str());
+  if ( !cmSystemTools::FileExists(fname.c_str()) )
+    {
+    // No subdirectory? So what...
+    return true;
+    }
+  cmSystemTools::ChangeDirectory(fname.c_str());
+  const char* testFilename;
+  if( cmSystemTools::FileExists("CTestTestfile.cmake") )
+    {
+    // does the CTestTestfile.cmake exist ?
+    testFilename = "CTestTestfile.cmake";
+    }
+  else
+    {
+    // No CTestTestfile? Who cares...
     cmSystemTools::ChangeDirectory(cwd.c_str());
-    if(!readit)
-      {
-      std::string m = "Could not find include file: ";
-      m += fname;
-      this->SetError(m.c_str());
-      return false;
-      }
+    return true;
+    }
+  fname += "/";
+  fname += testFilename;
+  bool readit = 
+    this->Makefile->ReadListFile(this->Makefile->GetCurrentListFile(),
+                                 fname.c_str());
+  cmSystemTools::ChangeDirectory(cwd.c_str());
+  if(!readit)
+    {
+    std::string m = "Could not find include file: ";
+    m += fname;
+    this->SetError(m.c_str());
+    return false;
     }
   return true;
 }
@@ -1260,8 +1258,9 @@
   newCom1->TestHandler = this;
   cm.AddCommand(newCom1);
 
-  // Add handler for SUBDIR
-  cmCTestSubdirCommand* newCom2 = new cmCTestSubdirCommand;
+  // Add handler for ADD_SUBDIRECTORY
+  cmCTestAddSubdirectoryCommand* newCom2 = 
+    new cmCTestAddSubdirectoryCommand;
   newCom2->TestHandler = this;
   cm.AddCommand(newCom2);
 



More information about the Cmake-commits mailing list