diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 8553b4b48..145792b72 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 00e8af68f..98d7cd26f 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 25a80ffdf..cf2907e83 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; @@ -299,6 +300,24 @@ void cmCTest::SetParallelLevel(int level) this->ParallelLevel = level < 1 ? 1 : 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) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 6fe1eb36d..120dd2e75 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 f5fba5c26..89a241ded 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2690,6 +2690,33 @@ bool cmSystemTools::ChangeRPath(std::string const& file, #endif } +//---------------------------------------------------------------------------- +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 6364870d0..e5bb305d7 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 */