[Cmake-commits] [cmake-commits] zach.mullen committed cmCTest.cxx 1.382 1.383 cmCTest.h 1.128 1.129 cmSystemTools.cxx 1.421 1.422 cmSystemTools.h 1.164 1.165

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Dec 21 12:27:06 EST 2009


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

Modified Files:
	cmCTest.cxx cmCTest.h cmSystemTools.cxx cmSystemTools.h 
Log Message:
Added support for CTest awareness of the CDash version.  This will help forward compatibility for both tools.  Note that this changeset effectively makes the default to disable output compression.  Now, to enable output compression, the CDASH_CTEST_VERSION must be explicity set to >= 1.6.  Automated detection of the CDash version is the next step.


Index: cmCTest.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.h,v
retrieving revision 1.128
retrieving revision 1.129
diff -C 2 -d -r1.128 -r1.129
*** cmCTest.h	16 Dec 2009 19:50:16 -0000	1.128
--- cmCTest.h	21 Dec 2009 17:27:04 -0000	1.129
***************
*** 196,200 ****
    bool ShouldUseHTTP10() { return this->UseHTTP10; }
  
!   bool ShouldCompressTestOutput() { return this->CompressTestOutput; }
  
    //Used for parallel ctest job scheduling
--- 196,200 ----
    bool ShouldUseHTTP10() { return this->UseHTTP10; }
  
!   bool ShouldCompressTestOutput();
  
    //Used for parallel ctest job scheduling
***************
*** 397,400 ****
--- 397,403 ----
    bool RunConfigurationScript;
  
+   //flag for lazy getter (optimization)
+   bool ComputedCompressOutput;
+ 
    int GenerateNotesFile(const char* files);
  

Index: cmSystemTools.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.h,v
retrieving revision 1.164
retrieving revision 1.165
diff -C 2 -d -r1.164 -r1.165
*** cmSystemTools.h	5 Nov 2009 20:00:15 -0000	1.164
--- cmSystemTools.h	21 Dec 2009 17:27:04 -0000	1.165
***************
*** 269,272 ****
--- 269,283 ----
    };
  
+   enum CompareOp {
+     OP_LESS,
+     OP_GREATER,
+     OP_EQUAL
+   };
+ 
+   /**
+    * Compare versions
+    */
+   static bool VersionCompare(CompareOp op, const char* lhs, const char* rhs);
+ 
    /**
     * Determine the file type based on the extension

Index: cmSystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v
retrieving revision 1.421
retrieving revision 1.422
diff -C 2 -d -r1.421 -r1.422
*** cmSystemTools.cxx	14 Nov 2009 13:48:32 -0000	1.421
--- cmSystemTools.cxx	21 Dec 2009 17:27:04 -0000	1.422
***************
*** 2692,2695 ****
--- 2692,2722 ----
  
  //----------------------------------------------------------------------------
+ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
+                                    const char* lhss, const char* rhss)
+ {
+   unsigned int lhs[4] = {0,0,0,0};
+   unsigned int rhs[4] = {0,0,0,0};
+   sscanf(lhss, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]);
+   sscanf(rhss, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]);
+ 
+   // Do component-wise comparison.
+   for(unsigned int i=0; i < 4; ++i)
+     {
+     if(lhs[i] < rhs[i])
+       {
+       // lhs < rhs, so true if operation is LESS
+       return op == cmSystemTools::OP_LESS;
+       }
+     else if(lhs[i] > rhs[i])
+       {
+       // lhs > rhs, so true if operation is GREATER
+         return op == cmSystemTools::OP_GREATER;
+       }
+     }
+   // lhs == rhs, so true if operation is EQUAL
+   return op == cmSystemTools::OP_EQUAL;
+ }
+ 
+ //----------------------------------------------------------------------------
  bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg,
                                  bool* removed)

Index: cmCTest.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmCTest.cxx,v
retrieving revision 1.382
retrieving revision 1.383
diff -C 2 -d -r1.382 -r1.383
*** cmCTest.cxx	16 Dec 2009 19:50:16 -0000	1.382
--- cmCTest.cxx	21 Dec 2009 17:27:04 -0000	1.383
***************
*** 223,226 ****
--- 223,227 ----
    this->UseHTTP10              = false;
    this->CompressTestOutput     = true;
+   this->ComputedCompressOutput = false;
    this->TestModel              = cmCTest::EXPERIMENTAL;
    this->MaxTestNameWidth       = 30;
***************
*** 301,304 ****
--- 302,323 ----
  
  //----------------------------------------------------------------------------
+ bool cmCTest::ShouldCompressTestOutput()
+ {
+   if(!this->ComputedCompressOutput)
+     {   
+     std::string cdashVersion = 
+       this->GetCTestConfiguration("CDashVersion");
+     //version >= 1.6?
+     bool cdashSupportsGzip = cmSystemTools::VersionCompare(
+       cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.6") ||
+       cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
+       cdashVersion.c_str(), "1.6");
+     this->CompressTestOutput &= cdashSupportsGzip;
+     this->ComputedCompressOutput = true;
+     }
+   return this->CompressTestOutput;
+ }
+ 
+ //----------------------------------------------------------------------------
  cmCTest::Part cmCTest::GetPartFromName(const char* name)
  {



More information about the Cmake-commits mailing list