summaryrefslogtreecommitdiffstats
path: root/src/testlib/qxmltestlogger.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-25 15:55:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-13 16:38:43 +0000
commit9b6cd2764a1516f3f6a13f9c3379603fe0d563a7 (patch)
tree486b2333cd2775f9bebba3bbfb6494542a106230 /src/testlib/qxmltestlogger.cpp
parentbba86a01c9828d03b1564984a08561d62686d329 (diff)
Testlib: Output function / total time along with crash dump.
Previously, only QXmlTestLogger had timers to take elapsed times and log them. Move those into class QTestLog for access by the loggers and output the times in the crash dump to make it easier to spot hangs/recursion crashes. Produces: QFATAL : foo() Received signal 11 Function time: 22ms Total time: 23ms A crash occurred in ... Function time: 24ms Total time: 26ms Task-number: QTBUG-47370 Change-Id: Ia530a63104087daffc9a15f68c15d93378b9407e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/testlib/qxmltestlogger.cpp')
-rw-r--r--src/testlib/qxmltestlogger.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp
index bf607b4702..f96b5647e4 100644
--- a/src/testlib/qxmltestlogger.cpp
+++ b/src/testlib/qxmltestlogger.cpp
@@ -36,6 +36,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtTest/private/qtestlog_p.h>
#include <QtTest/private/qxmltestlogger_p.h>
#include <QtTest/private/qtestresult_p.h>
#include <QtTest/private/qbenchmark_p.h>
@@ -124,15 +125,13 @@ void QXmlTestLogger::startLogging()
" <QTestVersion>" QTEST_VERSION_STR "</QTestVersion>\n"
"</Environment>\n", qVersion(), quotedBuild.constData());
outputString(buf.constData());
- m_totalTime.start();
}
void QXmlTestLogger::stopLogging()
{
QTestCharBuffer buf;
QTest::qt_asprintf(&buf,
- "<Duration msecs=\"%f\"/>\n",
- m_totalTime.nsecsElapsed() / 1000000.);
+ "<Duration msecs=\"%f\"/>\n", QTestLog::msecsTotalTime());
outputString(buf.constData());
if (xmlmode == QXmlTestLogger::Complete) {
outputString("</TestCase>\n");
@@ -148,8 +147,6 @@ void QXmlTestLogger::enterTestFunction(const char *function)
xmlQuote(&quotedFunction, function);
QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData());
outputString(buf.constData());
-
- m_functionTime.start();
}
void QXmlTestLogger::leaveTestFunction()
@@ -158,7 +155,7 @@ void QXmlTestLogger::leaveTestFunction()
QTest::qt_asprintf(&buf,
" <Duration msecs=\"%f\"/>\n"
"</TestFunction>\n",
- m_functionTime.nsecsElapsed() / 1000000.);
+ QTestLog::msecsFunctionTime());
outputString(buf.constData());
}