diff options
author | Zach Mullen <zach.mullen@kitware.com> | 2009-12-21 17:27:04 (GMT) |
---|---|---|
committer | Zach Mullen <zach.mullen@kitware.com> | 2009-12-21 17:27:04 (GMT) |
commit | 7af553188ec50c976a5d0c8174d2f47cac68d71d (patch) | |
tree | 65158f6a94f6707bbdb60060c9d8f1fd5b779b7e | |
parent | cb27cfb1cc6d8a273f69506414c2991b6c989621 (diff) | |
download | CMake-7af553188ec50c976a5d0c8174d2f47cac68d71d.zip CMake-7af553188ec50c976a5d0c8174d2f47cac68d71d.tar.gz CMake-7af553188ec50c976a5d0c8174d2f47cac68d71d.tar.bz2 |
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.
-rw-r--r-- | CTestConfig.cmake | 1 | ||||
-rw-r--r-- | Modules/DartConfiguration.tcl.in | 1 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 19 | ||||
-rw-r--r-- | Source/cmCTest.h | 5 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 27 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 11 |
6 files changed, 63 insertions, 1 deletions
diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 8553b4b..145792b 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -16,6 +16,7 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) +set(CTEST_CDASH_VERSION "1.4") # use old trigger stuff so that cmake 2.4 and below will not # get errors on trigger diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 00e8af6..98d7cd2 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -15,6 +15,7 @@ BuildName: @BUILDNAME@ # Submission information IsCDash: @CTEST_DROP_SITE_CDASH@ +CDashVersion: @CTEST_CDASH_VERSION@ DropSite: @DROP_SITE@ DropLocation: @DROP_LOCATION@ DropSiteUser: @DROP_SITE_USER@ diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 25a80ff..cf2907e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -222,6 +222,7 @@ cmCTest::cmCTest() this->RunConfigurationScript = false; this->UseHTTP10 = false; this->CompressTestOutput = true; + this->ComputedCompressOutput = false; this->TestModel = cmCTest::EXPERIMENTAL; this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; @@ -300,6 +301,24 @@ void cmCTest::SetParallelLevel(int level) } //---------------------------------------------------------------------------- +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) { // Look up by lower-case to make names case-insensitive. diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 6fe1eb3..120dd2e 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -195,7 +195,7 @@ public: bool ShouldUseHTTP10() { return this->UseHTTP10; } - bool ShouldCompressTestOutput() { return this->CompressTestOutput; } + bool ShouldCompressTestOutput(); //Used for parallel ctest job scheduling std::string GetScheduleType() { return this->ScheduleType; } @@ -396,6 +396,9 @@ private: bool RunConfigurationScript; + //flag for lazy getter (optimization) + bool ComputedCompressOutput; + int GenerateNotesFile(const char* files); // these are helper classes diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f5fba5c..89a241d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2691,6 +2691,33 @@ bool cmSystemTools::ChangeRPath(std::string const& file, } //---------------------------------------------------------------------------- +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) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 6364870..e5bb305 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -268,6 +268,17 @@ public: UNKNOWN_FILE_FORMAT }; + 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 */ |