diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-02-26 17:12:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-27 13:20:19 +0100 |
commit | 9e4a215a2569a04010292c8718d0f0569bc06c12 (patch) | |
tree | fb6a266f98b23d9706e651adf4553d2617893a37 /src | |
parent | 946d6bc329eb503682367c7445ec07d20fb21cbc (diff) |
Use new QLibraryInfo::build() in testlib to log build information.
This produces:
********* Start testing of tst_QtJson *********
Config: Using QtTest library 5.3.0, Qt 5.3.0 (Feb 13 2014, GCC 4.6.3, 64 bit, debug build)
PASS : tst_QtJson::initTestCase()
<?xml version="1.0" encoding="UTF-8"?>
<TestCase name="tst_QtJson">
<Environment>
<QtVersion>5.3.0</QtVersion>
<QtBuild>Qt 5.3.0 (Feb 13 2014, GCC 4.6.3, 64 bit, debug build)</QtBuild>
<QTestVersion>5.3.0</QTestVersion>
</Environment>
<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="1" failures="1" tests="42" name="tst_QtJson">
<properties>
<property value="5.3.0" name="QTestVersion"/>
<property value="5.3.0" name="QtVersion"/>
<property value="Qt 5.3.0 (Feb 13 2014, GCC 4.6.3, 64 bit, debug build)" name="QtBuild"/>
</properties>
<Environment>
<QtVersion>5.3.0</QtVersion>
<QtBuild>Qt 5.3.0 (Feb 13 2014, GCC 4.6.3, 64 bit, debug build)</QtBuild>
<QTestVersion>5.3.0</QTestVersion>
</Environment>
[ChangeLog][QtTest] Tests now output build information.
Change-Id: I0ab473371575f2b807db725256805b8bffea3454
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/testlib/qplaintestlogger.cpp | 18 | ||||
-rw-r--r-- | src/testlib/qxmltestlogger.cpp | 7 | ||||
-rw-r--r-- | src/testlib/qxunittestlogger.cpp | 14 |
3 files changed, 33 insertions, 6 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 39580f22d4..774f2cc4fb 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -51,21 +51,29 @@ #include <stdlib.h> #include <string.h> -#ifdef Q_OS_WIN -#include <windows.h> -#endif - #ifdef Q_OS_WINCE #include <QtCore/QString> #endif +#ifdef min // windows.h without NOMINMAX is included by the benchmark headers. +# undef min +#endif +#ifdef max +# undef max +#endif + #include <QtCore/QByteArray> #include <QtCore/qmath.h> +#include <QtCore/QLibraryInfo> #ifdef Q_OS_ANDROID # include <android/log.h> #endif +#ifdef Q_OS_WIN +# include <qt_windows.h> +#endif + QT_BEGIN_NAMESPACE namespace QTest { @@ -334,7 +342,7 @@ void QPlainTestLogger::startLogging() qsnprintf(buf, sizeof(buf), "********* Start testing of %s *********\n" "Config: Using QtTest library " QTEST_VERSION_STR - ", Qt %s\n", QTestResult::currentTestObjectName(), qVersion()); + ", %s\n", QTestResult::currentTestObjectName(), QLibraryInfo::build()); } outputMessage(buf); } diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index 3fff753c5c..5ea28bd46d 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -42,6 +42,7 @@ #include <stdio.h> #include <string.h> #include <QtCore/qglobal.h> +#include <QtCore/qlibraryinfo.h> #include <QtTest/private/qxmltestlogger_p.h> #include <QtTest/private/qtestresult_p.h> @@ -115,11 +116,15 @@ void QXmlTestLogger::startLogging() outputString(buf.constData()); } + QTestCharBuffer quotedBuild; + xmlQuote("edBuild, QLibraryInfo::build()); + QTest::qt_asprintf(&buf, "<Environment>\n" " <QtVersion>%s</QtVersion>\n" + " <QtBuild>%s</QtBuild>\n" " <QTestVersion>" QTEST_VERSION_STR "</QTestVersion>\n" - "</Environment>\n", qVersion()); + "</Environment>\n", qVersion(), quotedBuild.constData()); outputString(buf.constData()); m_totalTime.start(); } diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp index a47f77ae49..fe5b13eeeb 100644 --- a/src/testlib/qxunittestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -46,6 +46,15 @@ #include <QtTest/private/qtestresult_p.h> #include <QtTest/private/qbenchmark_p.h> +#ifdef min // windows.h without NOMINMAX is included by the benchmark headers. +# undef min +#endif +#ifdef max +# undef max +#endif + +#include <QtCore/qlibraryinfo.h> + #include <string.h> QT_BEGIN_NAMESPACE @@ -108,6 +117,11 @@ void QXunitTestLogger::stopLogging() property->addAttribute(QTest::AI_PropertyValue, qVersion()); properties->addLogElement(property); + property = new QTestElement(QTest::LET_Property); + property->addAttribute(QTest::AI_Name, "QtBuild"); + property->addAttribute(QTest::AI_PropertyValue, QLibraryInfo::build()); + properties->addLogElement(property); + currentLogElement->addLogElement(properties); currentLogElement->addLogElement(iterator); |