We will actually compress memcheck output if the server supports it.
This change won't be functional until the next release of CDash due to the version comparison.
This commit is contained in:
parent
8024c53389
commit
9c3a0b9f14
@ -344,9 +344,21 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
|
|||||||
}
|
}
|
||||||
this->MemoryTesterGlobalResults[kk] += memcheckresults[kk];
|
this->MemoryTesterGlobalResults[kk] += memcheckresults[kk];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string logTag;
|
||||||
|
if(this->CTest->ShouldCompressMemCheckOutput())
|
||||||
|
{
|
||||||
|
this->CTest->CompressString(memcheckstr);
|
||||||
|
logTag = "\t<Log compression=\"gzip\" encoding=\"base64\">\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logTag = "\t<Log>\n";
|
||||||
|
}
|
||||||
|
|
||||||
os
|
os
|
||||||
<< "\t\t</Results>\n"
|
<< "\t\t</Results>\n"
|
||||||
<< "\t<Log>\n" << memcheckstr << std::endl
|
<< logTag << memcheckstr << std::endl
|
||||||
<< "\t</Log>\n";
|
<< "\t</Log>\n";
|
||||||
this->WriteTestResultFooter(os, result);
|
this->WriteTestResultFooter(os, result);
|
||||||
if ( current < cc )
|
if ( current < cc )
|
||||||
|
@ -135,7 +135,10 @@ void cmCTestRunTest::CompressOutput()
|
|||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
||||||
{
|
{
|
||||||
if (!this->TestHandler->MemCheck && this->CTest->ShouldCompressTestOutput())
|
if ((!this->TestHandler->MemCheck &&
|
||||||
|
this->CTest->ShouldCompressTestOutput()) ||
|
||||||
|
(this->TestHandler->MemCheck &&
|
||||||
|
this->CTest->ShouldCompressMemCheckOutput()))
|
||||||
{
|
{
|
||||||
this->CompressOutput();
|
this->CompressOutput();
|
||||||
}
|
}
|
||||||
@ -279,11 +282,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
|||||||
// Output since that is what is parsed by cmCTestMemCheckHandler
|
// Output since that is what is parsed by cmCTestMemCheckHandler
|
||||||
if(!this->TestHandler->MemCheck && started)
|
if(!this->TestHandler->MemCheck && started)
|
||||||
{
|
{
|
||||||
this->TestHandler->CleanTestOutput(this->ProcessOutput,
|
this->TestHandler->CleanTestOutput(this->ProcessOutput,
|
||||||
static_cast<size_t>
|
static_cast<size_t>
|
||||||
(this->TestResult.Status == cmCTestTestHandler::COMPLETED ?
|
(this->TestResult.Status == cmCTestTestHandler::COMPLETED ?
|
||||||
this->TestHandler->CustomMaximumPassedTestOutputSize :
|
this->TestHandler->CustomMaximumPassedTestOutputSize :
|
||||||
this->TestHandler->CustomMaximumFailedTestOutputSize));
|
this->TestHandler->CustomMaximumFailedTestOutputSize));
|
||||||
}
|
}
|
||||||
this->TestResult.Reason = reason;
|
this->TestResult.Reason = reason;
|
||||||
if (this->TestHandler->LogFile)
|
if (this->TestHandler->LogFile)
|
||||||
|
@ -50,6 +50,9 @@
|
|||||||
|
|
||||||
#include <memory> // auto_ptr
|
#include <memory> // auto_ptr
|
||||||
|
|
||||||
|
#include <cm_zlib.h>
|
||||||
|
#include <cmsys/Base64.h>
|
||||||
|
|
||||||
#if defined(__BEOS__) && !defined(__HAIKU__)
|
#if defined(__BEOS__) && !defined(__HAIKU__)
|
||||||
#include <be/kernel/OS.h> /* disable_debugger() API. */
|
#include <be/kernel/OS.h> /* disable_debugger() API. */
|
||||||
#endif
|
#endif
|
||||||
@ -308,7 +311,7 @@ cmCTest::cmCTest()
|
|||||||
this->UseHTTP10 = false;
|
this->UseHTTP10 = false;
|
||||||
this->PrintLabels = false;
|
this->PrintLabels = false;
|
||||||
this->CompressTestOutput = true;
|
this->CompressTestOutput = true;
|
||||||
this->ComputedCompressOutput = false;
|
this->CompressMemCheckOutput = true;
|
||||||
this->TestModel = cmCTest::EXPERIMENTAL;
|
this->TestModel = cmCTest::EXPERIMENTAL;
|
||||||
this->MaxTestNameWidth = 30;
|
this->MaxTestNameWidth = 30;
|
||||||
this->InteractiveDebugMode = true;
|
this->InteractiveDebugMode = true;
|
||||||
@ -325,6 +328,8 @@ cmCTest::cmCTest()
|
|||||||
this->SuppressUpdatingCTestConfiguration = false;
|
this->SuppressUpdatingCTestConfiguration = false;
|
||||||
this->DartVersion = 1;
|
this->DartVersion = 1;
|
||||||
this->OutputTestOutputOnTestFailure = false;
|
this->OutputTestOutputOnTestFailure = false;
|
||||||
|
this->ComputedCompressTestOutput = false;
|
||||||
|
this->ComputedCompressMemCheckOutput = false;
|
||||||
if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE"))
|
if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE"))
|
||||||
{
|
{
|
||||||
this->OutputTestOutputOnTestFailure = true;
|
this->OutputTestOutputOnTestFailure = true;
|
||||||
@ -394,7 +399,7 @@ void cmCTest::SetParallelLevel(int level)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmCTest::ShouldCompressTestOutput()
|
bool cmCTest::ShouldCompressTestOutput()
|
||||||
{
|
{
|
||||||
if(!this->ComputedCompressOutput)
|
if(!this->ComputedCompressTestOutput)
|
||||||
{
|
{
|
||||||
std::string cdashVersion = this->GetCDashVersion();
|
std::string cdashVersion = this->GetCDashVersion();
|
||||||
//version >= 1.6?
|
//version >= 1.6?
|
||||||
@ -403,11 +408,26 @@ bool cmCTest::ShouldCompressTestOutput()
|
|||||||
cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
|
cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
|
||||||
cdashVersion.c_str(), "1.6");
|
cdashVersion.c_str(), "1.6");
|
||||||
this->CompressTestOutput &= cdashSupportsGzip;
|
this->CompressTestOutput &= cdashSupportsGzip;
|
||||||
this->ComputedCompressOutput = true;
|
this->ComputedCompressTestOutput = true;
|
||||||
}
|
}
|
||||||
return this->CompressTestOutput;
|
return this->CompressTestOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmCTest::ShouldCompressMemCheckOutput()
|
||||||
|
{
|
||||||
|
if(!this->ComputedCompressMemCheckOutput)
|
||||||
|
{
|
||||||
|
std::string cdashVersion = this->GetCDashVersion();
|
||||||
|
|
||||||
|
bool compressionSupported = cmSystemTools::VersionCompare(
|
||||||
|
cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.9.0");
|
||||||
|
this->CompressMemCheckOutput &= compressionSupported;
|
||||||
|
this->ComputedCompressMemCheckOutput = true;
|
||||||
|
}
|
||||||
|
return this->CompressMemCheckOutput;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string cmCTest::GetCDashVersion()
|
std::string cmCTest::GetCDashVersion()
|
||||||
{
|
{
|
||||||
@ -1926,6 +1946,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
|
|||||||
if(this->CheckArgument(arg, "--no-compress-output"))
|
if(this->CheckArgument(arg, "--no-compress-output"))
|
||||||
{
|
{
|
||||||
this->CompressTestOutput = false;
|
this->CompressTestOutput = false;
|
||||||
|
this->CompressMemCheckOutput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->CheckArgument(arg, "--print-labels"))
|
if(this->CheckArgument(arg, "--print-labels"))
|
||||||
@ -3055,3 +3076,56 @@ void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
|
|||||||
}
|
}
|
||||||
cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
|
cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
bool cmCTest::CompressString(std::string& str)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
z_stream strm;
|
||||||
|
|
||||||
|
unsigned char* in = reinterpret_cast<unsigned char*>(
|
||||||
|
const_cast<char*>(str.c_str()));
|
||||||
|
//zlib makes the guarantee that this is the maximum output size
|
||||||
|
int outSize = static_cast<int>(
|
||||||
|
static_cast<double>(str.size()) * 1.001 + 13.0);
|
||||||
|
unsigned char* out = new unsigned char[outSize];
|
||||||
|
|
||||||
|
strm.zalloc = Z_NULL;
|
||||||
|
strm.zfree = Z_NULL;
|
||||||
|
strm.opaque = Z_NULL;
|
||||||
|
ret = deflateInit(&strm, -1); //default compression level
|
||||||
|
if (ret != Z_OK)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
strm.avail_in = str.size();
|
||||||
|
strm.next_in = in;
|
||||||
|
strm.avail_out = outSize;
|
||||||
|
strm.next_out = out;
|
||||||
|
ret = deflate(&strm, Z_FINISH);
|
||||||
|
|
||||||
|
if(ret == Z_STREAM_ERROR || ret != Z_STREAM_END)
|
||||||
|
{
|
||||||
|
cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression."
|
||||||
|
<< std::endl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)deflateEnd(&strm);
|
||||||
|
|
||||||
|
// Now base64 encode the resulting binary string
|
||||||
|
unsigned char* base64EncodedBuffer
|
||||||
|
= new unsigned char[static_cast<int>(outSize * 1.5)];
|
||||||
|
|
||||||
|
unsigned long rlen
|
||||||
|
= cmsysBase64_Encode(out, strm.total_out, base64EncodedBuffer, 1);
|
||||||
|
|
||||||
|
str = "";
|
||||||
|
str.append(reinterpret_cast<char*>(base64EncodedBuffer), rlen);
|
||||||
|
|
||||||
|
delete [] base64EncodedBuffer;
|
||||||
|
delete [] out;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -219,6 +219,8 @@ public:
|
|||||||
bool ShouldPrintLabels() { return this->PrintLabels; }
|
bool ShouldPrintLabels() { return this->PrintLabels; }
|
||||||
|
|
||||||
bool ShouldCompressTestOutput();
|
bool ShouldCompressTestOutput();
|
||||||
|
bool ShouldCompressMemCheckOutput();
|
||||||
|
bool CompressString(std::string& str);
|
||||||
|
|
||||||
std::string GetCDashVersion();
|
std::string GetCDashVersion();
|
||||||
|
|
||||||
@ -430,7 +432,8 @@ private:
|
|||||||
bool RunConfigurationScript;
|
bool RunConfigurationScript;
|
||||||
|
|
||||||
//flag for lazy getter (optimization)
|
//flag for lazy getter (optimization)
|
||||||
bool ComputedCompressOutput;
|
bool ComputedCompressTestOutput;
|
||||||
|
bool ComputedCompressMemCheckOutput;
|
||||||
|
|
||||||
int GenerateNotesFile(const char* files);
|
int GenerateNotesFile(const char* files);
|
||||||
|
|
||||||
@ -487,8 +490,8 @@ private:
|
|||||||
bool ShortDateFormat;
|
bool ShortDateFormat;
|
||||||
|
|
||||||
bool CompressXMLFiles;
|
bool CompressXMLFiles;
|
||||||
|
|
||||||
bool CompressTestOutput;
|
bool CompressTestOutput;
|
||||||
|
bool CompressMemCheckOutput;
|
||||||
|
|
||||||
void InitStreams();
|
void InitStreams();
|
||||||
std::ostream* StreamOut;
|
std::ostream* StreamOut;
|
||||||
|
@ -2603,7 +2603,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
|
|||||||
else if(lhs[i] > rhs[i])
|
else if(lhs[i] > rhs[i])
|
||||||
{
|
{
|
||||||
// lhs > rhs, so true if operation is GREATER
|
// lhs > rhs, so true if operation is GREATER
|
||||||
return op == cmSystemTools::OP_GREATER;
|
return op == cmSystemTools::OP_GREATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// lhs == rhs, so true if operation is EQUAL
|
// lhs == rhs, so true if operation is EQUAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user