Query the CDash web API to automate CDash version detection.

This commit is contained in:
Zach Mullen 2009-12-21 15:47:29 -05:00
parent 3ff0b94055
commit a302b51db5
2 changed files with 17 additions and 3 deletions

View File

@ -304,9 +304,8 @@ void cmCTest::SetParallelLevel(int level)
bool cmCTest::ShouldCompressTestOutput() bool cmCTest::ShouldCompressTestOutput()
{ {
if(!this->ComputedCompressOutput) if(!this->ComputedCompressOutput)
{ {
std::string cdashVersion = std::string cdashVersion = this->GetCDashVersion();
this->GetCTestConfiguration("CDashVersion");
//version >= 1.6? //version >= 1.6?
bool cdashSupportsGzip = cmSystemTools::VersionCompare( bool cdashSupportsGzip = cmSystemTools::VersionCompare(
cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.6") || cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.6") ||
@ -318,6 +317,19 @@ bool cmCTest::ShouldCompressTestOutput()
return this->CompressTestOutput; return this->CompressTestOutput;
} }
//----------------------------------------------------------------------------
std::string cmCTest::GetCDashVersion()
{
//First query the server. If that fails, fall back to the local setting
std::string response;
std::string url = "http://";
url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php";
int res = cmSystemTools::HTTPRequest(url, cmSystemTools::HTTP_GET, response);
return res ? this->GetCTestConfiguration("CDashVersion") : response;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmCTest::Part cmCTest::GetPartFromName(const char* name) cmCTest::Part cmCTest::GetPartFromName(const char* name)
{ {

View File

@ -197,6 +197,8 @@ public:
bool ShouldCompressTestOutput(); bool ShouldCompressTestOutput();
std::string GetCDashVersion();
//Used for parallel ctest job scheduling //Used for parallel ctest job scheduling
std::string GetScheduleType() { return this->ScheduleType; } std::string GetScheduleType() { return this->ScheduleType; }
void SetScheduleType(std::string type) { this->ScheduleType = type; } void SetScheduleType(std::string type) { this->ScheduleType = type; }