summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CTestConfig.cmake1
-rw-r--r--Modules/DartConfiguration.tcl.in1
-rw-r--r--Source/cmCTest.cxx19
-rw-r--r--Source/cmCTest.h5
-rw-r--r--Source/cmSystemTools.cxx27
-rw-r--r--Source/cmSystemTools.h11
6 files changed, 63 insertions, 1 deletions
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 8553b4b489..145792b726 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 00e8af68fc..98d7cd26f5 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 25a80ffdf1..cf2907e83c 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 6fe1eb36d5..120dd2e759 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 f5fba5c269..89a241ded2 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 6364870d05..e5bb305d72 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
*/