diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-07-26 15:52:10 -0400 |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-07-26 15:52:10 -0400 |
commit | fd50bc476c8995084b2339fad6e37be09a211850 (patch) | |
tree | 098dd1387b8d48fc6b28c55533beeff92b1f01d9 /Source | |
parent | 67d3634e46d5948d381fccd76913947f1921d91b (diff) | |
download | cmake-fd50bc476c8995084b2339fad6e37be09a211850.tar.gz |
ENH: Add maximum size of test output
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCTest.cxx | 45 | ||||
-rw-r--r-- | Source/cmCTest.h | 4 |
2 files changed, 48 insertions, 1 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d1648beb94..6bc9bd7003 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -375,6 +375,8 @@ cmCTest::cmCTest() { m_Tests[cc] = 0; } + m_MaximumPassedTestResultSize = 100 * 1024; + m_MaximumFailedTestResultSize = 200 * 1024; } int cmCTest::Initialize() @@ -2962,7 +2964,29 @@ void cmCTest::GenerateDartTestOutput(std::ostream& os) } os << "\t\t\t<Measurement>\n" - << "\t\t\t\t<Value>" << this->MakeXMLSafe(result->m_Output) + << "\t\t\t\t<Value>"; + size_t truncate = result->m_Output.size(); + if ( result->m_Status == cmCTest::COMPLETED ) + { + if ( result->m_Output.size() > m_MaximumPassedTestResultSize ) + { + truncate = m_MaximumPassedTestResultSize; + } + } + else + { + if ( result->m_Output.size() > m_MaximumFailedTestResultSize ) + { + truncate = m_MaximumFailedTestResultSize; + } + } + os << this->MakeXMLSafe(result->m_Output.substr(0, truncate)); + if ( truncate < result->m_Output.size() ) + { + os << "...\n\nThe output was stirpped because it excedes maximum allowed size: " + << truncate << std::endl; + } + os << "</Value>\n" << "\t\t\t</Measurement>\n" << "\t\t</Results>\n" @@ -5143,6 +5167,25 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir) this->PopulateCustomVector(mf, "CTEST_CUSTOM_PRE_MEMCHECK", m_CustomPreMemCheck); this->PopulateCustomVector(mf, "CTEST_CUSTOM_POST_MEMCHECK", m_CustomPostMemCheck); + const char* maxstr = mf->GetDefinition("CTEST_CUSTOM_PASSED_TEST_STRING_MAXLEN"); + if ( maxstr ) + { + long val = atoi(maxstr); + if ( val > 0 ) + { + m_MaximumPassedTestResultSize = val; + } + } + maxstr = mf->GetDefinition("CTEST_CUSTOM_FAILED_TEST_STRING_MAXLEN"); + if ( maxstr ) + { + long val = atoi(maxstr); + if ( val > 0 ) + { + m_MaximumFailedTestResultSize = val; + } + } + return 1; } diff --git a/Source/cmCTest.h b/Source/cmCTest.h index f8075f4f96..24ec541402 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -424,6 +424,10 @@ private: ///! Get the current time as string std::string CurrentTime(); + + ///! Maximum size of testing string + std::string::size_type m_MaximumPassedTestResultSize; + std::string::size_type m_MaximumFailedTestResultSize; }; #endif |