[Cmake-commits] [cmake-commits] king committed cmCTestBuildHandler.cxx 1.72 1.73 cmCTestLaunch.cxx 1.2 1.3 cmCTestLaunch.h 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 12 13:00:24 EST 2009


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

Modified Files:
	cmCTestBuildHandler.cxx cmCTestLaunch.cxx cmCTestLaunch.h 
Log Message:
ENH: Report file names relative to source dir

This teaches cmCTestLaunch to report source files that lie under the top
source directory relative to the top.


Index: cmCTestLaunch.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestLaunch.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** cmCTestLaunch.cxx	11 Feb 2009 16:57:24 -0000	1.2
--- cmCTestLaunch.cxx	12 Feb 2009 18:00:22 -0000	1.3
***************
*** 293,296 ****
--- 293,297 ----
      }
  
+   this->LoadConfig();
    this->WriteXML();
  
***************
*** 415,420 ****
    if(!this->OptionSource.empty())
      {
      fxml << "\t\t\t<SourceFile>"
!          << cmXMLSafe(this->OptionSource)
           << "</SourceFile>\n";
      }
--- 416,434 ----
    if(!this->OptionSource.empty())
      {
+     std::string source = this->OptionSource;
+     cmSystemTools::ConvertToUnixSlashes(source);
+ 
+     // If file is in source tree use its relative location.
+     if(cmSystemTools::FileIsFullPath(this->SourceDir.c_str()) &&
+        cmSystemTools::FileIsFullPath(source.c_str()) &&
+        cmSystemTools::IsSubDirectory(source.c_str(),
+                                      this->SourceDir.c_str()))
+       {
+       source = cmSystemTools::RelativePath(this->SourceDir.c_str(),
+                                            source.c_str());
+       }
+ 
      fxml << "\t\t\t<SourceFile>"
!          << cmXMLSafe(source)
           << "</SourceFile>\n";
      }
***************
*** 679,680 ****
--- 693,717 ----
    return self.Run();
  }
+ 
+ //----------------------------------------------------------------------------
+ #include "cmGlobalGenerator.h"
+ #include "cmLocalGenerator.h"
+ #include "cmMakefile.h"
+ #include "cmake.h"
+ #include <cmsys/auto_ptr.hxx>
+ void cmCTestLaunch::LoadConfig()
+ {
+   cmake cm;
+   cmGlobalGenerator gg;
+   gg.SetCMakeInstance(&cm);
+   cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
+   cmMakefile* mf = lg->GetMakefile();
+   std::string fname = this->LogDir;
+   fname += "CTestLaunchConfig.cmake";
+   if(cmSystemTools::FileExists(fname.c_str()) &&
+      mf->ReadListFile(0, fname.c_str()))
+     {
+     this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY");
+     cmSystemTools::ConvertToUnixSlashes(this->SourceDir);
+     }
+ }

Index: cmCTestBuildHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.cxx,v
retrieving revision 1.72
retrieving revision 1.73
diff -C 2 -d -r1.72 -r1.73
*** cmCTestBuildHandler.cxx	12 Feb 2009 15:01:39 -0000	1.72
--- cmCTestBuildHandler.cxx	12 Feb 2009 18:00:22 -0000	1.73
***************
*** 753,757 ****
    cmCTest* CTest;
  
!   void WriteScrapeMatchers();
    void WriteScrapeMatchers(const char* purpose,
                             std::vector<std::string> const& matchers);
--- 753,757 ----
    cmCTest* CTest;
  
!   void WriteLauncherConfig();
    void WriteScrapeMatchers(const char* purpose,
                             std::vector<std::string> const& matchers);
***************
*** 785,789 ****
        // Enable launcher fragments.
        cmSystemTools::MakeDirectory(launchDir.c_str());
!       this->WriteScrapeMatchers();
        std::string launchEnv = "CTEST_LAUNCH_LOGS=";
        launchEnv += launchDir;
--- 785,789 ----
        // Enable launcher fragments.
        cmSystemTools::MakeDirectory(launchDir.c_str());
!       this->WriteLauncherConfig();
        std::string launchEnv = "CTEST_LAUNCH_LOGS=";
        launchEnv += launchDir;
***************
*** 809,813 ****
  
  //----------------------------------------------------------------------------
! void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers()
  {
    this->WriteScrapeMatchers("Warning",
--- 809,813 ----
  
  //----------------------------------------------------------------------------
! void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig()
  {
    this->WriteScrapeMatchers("Warning",
***************
*** 815,818 ****
--- 815,825 ----
    this->WriteScrapeMatchers("WarningSuppress",
                              this->Handler->ReallyCustomWarningExceptions);
+ 
+   // Give some testing configuration information to the launcher.
+   std::string fname = this->Handler->CTestLaunchDir;
+   fname += "/CTestLaunchConfig.cmake";
+   cmGeneratedFileStream fout(fname.c_str());
+   std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
+   fout << "set(CTEST_SOURCE_DIRECTORY \"" << srcdir << "\")\n";
  }
  

Index: cmCTestLaunch.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestLaunch.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** cmCTestLaunch.h	11 Feb 2009 16:31:25 -0000	1.1
--- cmCTestLaunch.h	12 Feb 2009 18:00:22 -0000	1.2
***************
*** 101,104 ****
--- 101,108 ----
    void WriteXMLLabels(std::ostream& fxml);
    void DumpFileToXML(std::ostream& fxml, std::string const& fname);
+ 
+   // Configuration
+   void LoadConfig();
+   std::string SourceDir;
  };
  



More information about the Cmake-commits mailing list