summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-07-26 19:52:10 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-07-26 19:52:10 (GMT)
commitfd50bc476c8995084b2339fad6e37be09a211850 (patch)
tree098dd1387b8d48fc6b28c55533beeff92b1f01d9
parent67d3634e46d5948d381fccd76913947f1921d91b (diff)
downloadCMake-fd50bc476c8995084b2339fad6e37be09a211850.zip
CMake-fd50bc476c8995084b2339fad6e37be09a211850.tar.gz
CMake-fd50bc476c8995084b2339fad6e37be09a211850.tar.bz2
ENH: Add maximum size of test output
-rw-r--r--Source/cmCTest.cxx45
-rw-r--r--Source/cmCTest.h4
2 files changed, 48 insertions, 1 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index d1648be..6bc9bd7 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 f8075f4..24ec541 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