diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-26 04:34:17 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-26 04:34:17 (GMT) |
commit | aa19362a14ce20bde2ada61edf7b946019845ed2 (patch) | |
tree | fe31f6c8bddb37c5aa93a5f41d1a3d0e1eb6fc48 | |
parent | 9d5f03fceb43946b4db0731f66c2f27c01d3cd6f (diff) | |
parent | 4866d1ba8afbab61e102942d1ea93b81fea053d6 (diff) | |
download | Qt-aa19362a14ce20bde2ada61edf7b946019845ed2.zip Qt-aa19362a14ce20bde2ada61edf7b946019845ed2.tar.gz Qt-aa19362a14ce20bde2ada61edf7b946019845ed2.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qa-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qa-staging:
Add test case name and drop parentheses for -datatags option.
Adding QTDIR validation in tst_symbols autotest
Disabled benchmarks referring to private headers.
Add license header to printdatatags autotests
Compile on symbian^3
Compile on Symbian^3.
Added -datatags option to QTestLib
Fixed failure of tst_qxmlquery::evaluateToReceiver
22 files changed, 366 insertions, 9 deletions
diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 10ae285..3b338e3 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -181,6 +181,9 @@ outputs the possible command line arguments and give some useful help. \o \c -functions \BR outputs all test functions available in the test. + \o \c -datatags \BR + outputs all data tags available in the test. + A global data tag is preceded by ' __global__ '. \o \c -o \e filename \BR write output to the specified file, rather than to standard output \o \c -silent \BR diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 023df89..d2ea988 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1015,6 +1015,7 @@ static bool isValidSlot(const QMetaMethod &sl) } Q_TESTLIB_EXPORT bool printAvailableFunctions = false; +Q_TESTLIB_EXPORT bool printAvailableTags = false; Q_TESTLIB_EXPORT QStringList testFunctions; Q_TESTLIB_EXPORT QStringList testTags; @@ -1027,6 +1028,65 @@ static void qPrintTestSlots() } } +static void qPrintDataTags() +{ + // Get global data tags: + QTestTable::globalTestTable(); + invokeMethod(QTest::currentTestObject, "initTestCase_data()"); + const QTestTable *gTable = QTestTable::globalTestTable(); + + const QMetaObject *currTestMetaObj = QTest::currentTestObject->metaObject(); + + // Process test functions: + for (int i = 0; i < currTestMetaObj->methodCount(); ++i) { + QMetaMethod tf = currTestMetaObj->method(i); + if (isValidSlot(tf)) { + // Retrieve local tags: + QStringList localTags; + QTestTable table; + char member[512]; + char *slot = qstrdup(tf.signature()); + slot[strlen(slot) - 2] = '\0'; + QTest::qt_snprintf(member, 512, "%s_data()", slot); + invokeMethod(QTest::currentTestObject, member); + for (int j = 0; j < table.dataCount(); ++j) + localTags << QLatin1String(table.testData(j)->dataTag()); + + // Print all tag combinations: + if (gTable->dataCount() == 0) { + if (localTags.count() == 0) { + // No tags at all, so just print the test function: + printf("%s %s\n", currTestMetaObj->className(), slot); + } else { + // Only local tags, so print each of them: + for (int k = 0; k < localTags.size(); ++k) + printf( + "%s %s %s\n", + currTestMetaObj->className(), slot, localTags.at(k).toLatin1().data()); + } + } else { + for (int j = 0; j < gTable->dataCount(); ++j) { + if (localTags.count() == 0) { + // Only global tags, so print the current one: + printf( + "%s %s __global__ %s\n", + currTestMetaObj->className(), slot, gTable->testData(j)->dataTag()); + } else { + // Local and global tags, so print each of the local ones and + // the current global one: + for (int k = 0; k < localTags.size(); ++k) + printf( + "%s %s %s __global__ %s\n", currTestMetaObj->className(), slot, + localTags.at(k).toLatin1().data(), gTable->testData(j)->dataTag()); + } + } + } + + delete[] slot; + } + } +} + static int qToInt(char *str) { char *pEnd; @@ -1043,6 +1103,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) const char *testOptions = " options:\n" " -functions : Returns a list of current testfunctions\n" + " -datatags : Returns a list of current data tags.\n" + " A global data tag is preceded by ' __global__ '.\n" " -xunitxml : Outputs results as XML XUnit document\n" " -xml : Outputs results as XML document\n" " -lightxml : Outputs results as stream of XML tags\n" @@ -1094,6 +1156,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) qPrintTestSlots(); exit(0); } + } else if (strcmp(argv[i], "-datatags") == 0) { + QTest::printAvailableTags = true; + if (!qml) { + qPrintDataTags(); + exit(0); + } } else if(strcmp(argv[i], "-xunitxml") == 0){ QTestLog::setLogMode(QTestLog::XunitXML); } else if (strcmp(argv[i], "-xml") == 0) { diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 8a2d559..03fafe0 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -191,6 +191,8 @@ void initLogger() } } +extern Q_TESTLIB_EXPORT bool printAvailableTags; + } QTestLog::QTestLog() @@ -203,6 +205,9 @@ QTestLog::~QTestLog() void QTestLog::enterTestFunction(const char* function) { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(function); @@ -222,6 +227,9 @@ int QTestLog::unhandledIgnoreMessages() void QTestLog::leaveTestFunction() { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTest::IgnoreResultList::clearList(QTest::ignoreResultList); @@ -244,6 +252,9 @@ void QTestLog::printUnhandledIgnoreMessages() void QTestLog::addPass(const char *msg) { + if (QTest::printAvailableTags) + return; + QTEST_ASSERT(QTest::testLogger); QTEST_ASSERT(msg); diff --git a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref index cceabfe..ddb5bc7 100644 --- a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref +++ b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref @@ -1,6 +1,6 @@ startOfSequence() atomicValue(xs:untypedAtomic) -atomicValue(2002-10-10T23:02:11) +atomicValue(2002-10-10T23:02:11Z) atomicValue(2002-10-10) atomicValue() atomicValue() diff --git a/tests/auto/selftests/expected_printdatatags.txt b/tests/auto/selftests/expected_printdatatags.txt new file mode 100644 index 0000000..ac22f23 --- /dev/null +++ b/tests/auto/selftests/expected_printdatatags.txt @@ -0,0 +1,6 @@ +tst_MyTestCase a data tag a1 +tst_MyTestCase a data tag a2 +tst_MyTestCase b +tst_MyTestCase c data tag c1 +tst_MyTestCase c data tag c2 +tst_MyTestCase c data tag c3 diff --git a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt new file mode 100644 index 0000000..32feba4 --- /dev/null +++ b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt @@ -0,0 +1,12 @@ +tst_MyTestCase a data tag a1 __global__ global data tag 1 +tst_MyTestCase a data tag a2 __global__ global data tag 1 +tst_MyTestCase a data tag a1 __global__ global data tag 2 +tst_MyTestCase a data tag a2 __global__ global data tag 2 +tst_MyTestCase b __global__ global data tag 1 +tst_MyTestCase b __global__ global data tag 2 +tst_MyTestCase c data tag c1 __global__ global data tag 1 +tst_MyTestCase c data tag c2 __global__ global data tag 1 +tst_MyTestCase c data tag c3 __global__ global data tag 1 +tst_MyTestCase c data tag c1 __global__ global data tag 2 +tst_MyTestCase c data tag c2 __global__ global data tag 2 +tst_MyTestCase c data tag c3 __global__ global data tag 2 diff --git a/tests/auto/selftests/printdatatags/printdatatags.pro b/tests/auto/selftests/printdatatags/printdatatags.pro new file mode 100644 index 0000000..a134422 --- /dev/null +++ b/tests/auto/selftests/printdatatags/printdatatags.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +SOURCES += tst_printdatatags.cpp +QT = core + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = printdatatags diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp new file mode 100644 index 0000000..79f8890 --- /dev/null +++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +class tst_MyTestCase: public QObject +{ + Q_OBJECT +private slots: + void a_data() const; + void a() const; + + void b() const; + + void c_data() const; + void c() const; +}; + +void tst_MyTestCase::a_data() const +{ + QTest::addColumn<int>("x"); + QTest::addColumn<int>("y"); + + QTest::newRow("data tag a1 ") << 1 << 2; + QTest::newRow("data tag a2") << 1 << 2; +} + +void tst_MyTestCase::a() const +{ +} + +void tst_MyTestCase::b() const +{ +} + +void tst_MyTestCase::c_data() const +{ + QTest::addColumn<int>("x"); + + QTest::newRow("data tag c1") << 1; + QTest::newRow("data tag c2") << 1; + QTest::newRow("data tag c3") << 1; +} + +void tst_MyTestCase::c() const +{ +} + +QTEST_MAIN(tst_MyTestCase) + +#include "tst_printdatatags.moc" diff --git a/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro new file mode 100644 index 0000000..100ba1c --- /dev/null +++ b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +SOURCES += tst_printdatatagswithglobaltags.cpp +QT = core + +mac:CONFIG -= app_bundle +CONFIG -= debug_and_release_target + +TARGET = printdatatagswithglobaltags diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp new file mode 100644 index 0000000..6b0e61b --- /dev/null +++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtTest/QtTest> + +class tst_MyTestCase: public QObject +{ + Q_OBJECT +private slots: + void initTestCase_data() const; + void initTestCase() const; + + void a_data() const; + void a() const; + + void b() const; + + void c_data() const; + void c() const; +}; + +void tst_MyTestCase::initTestCase_data() const +{ + QTest::addColumn<int>("f"); + QTest::addColumn<int>("g"); + + QTest::newRow("global data tag 1 ") << 1 << 2; + QTest::newRow("global data tag 2") << 1 << 2; +} + +void tst_MyTestCase::initTestCase() const +{ +} + +void tst_MyTestCase::a_data() const +{ + QTest::addColumn<int>("x"); + QTest::addColumn<int>("y"); + + QTest::newRow("data tag a1 ") << 1 << 2; + QTest::newRow("data tag a2") << 1 << 2; +} + +void tst_MyTestCase::a() const +{ +} + +void tst_MyTestCase::b() const +{ +} + +void tst_MyTestCase::c_data() const +{ + QTest::addColumn<int>("x"); + + QTest::newRow("data tag c1") << 1; + QTest::newRow("data tag c2") << 1; + QTest::newRow("data tag c3") << 1; +} + +void tst_MyTestCase::c() const +{ +} + +QTEST_MAIN(tst_MyTestCase) + +#include "tst_printdatatagswithglobaltags.moc" diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro index 2f1c327..74cd075 100644 --- a/tests/auto/selftests/selftests.pro +++ b/tests/auto/selftests/selftests.pro @@ -5,7 +5,8 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \ skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \ exceptionthrow qexecstringlist datatable commandlinedata\ benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \ - benchliboptions xunit badxml longstring + benchliboptions xunit badxml longstring printdatatags \ + printdatatagswithglobaltags INSTALLS = diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc index f82722b..5bd0e12 100644 --- a/tests/auto/selftests/selftests.qrc +++ b/tests/auto/selftests/selftests.qrc @@ -89,6 +89,8 @@ <file>expected_multiexec.txt</file> <file>expected_multiexec.xml</file> <file>expected_multiexec.xunitxml</file> + <file>expected_printdatatags.txt</file> + <file>expected_printdatatagswithglobaltags.txt</file> <file>expected_qexecstringlist.txt</file> <file>expected_singleskip.lightxml</file> <file>expected_singleskip.txt</file> diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a95420..3686304 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -245,6 +245,8 @@ void tst_Selftests::runSubTest_data() << "xunit" << "longstring" << "badxml" + << "printdatatags" + << "printdatatagswithglobaltags" ; foreach (Logger const& logger, allLoggers()) { @@ -273,6 +275,12 @@ void tst_Selftests::runSubTest_data() else if (subtest == "badxml") { arguments << "-eventcounter"; } + else if (subtest == "printdatatags") { + arguments << "-datatags"; + } + else if (subtest == "printdatatagswithglobaltags") { + arguments << "-datatags"; + } // These tests don't work right with loggers other than plain, usually because // they internally supply arguments to themselves. @@ -289,6 +297,12 @@ void tst_Selftests::runSubTest_data() if (subtest == "waitwithoutgui") { continue; } + if (subtest == "printdatatags") { + continue; + } + if (subtest == "printdatatagswithglobaltags") { + continue; + } // `crashes' will not output valid XML on platforms without a crash handler if (subtest == "crashes") { continue; diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp index 00486d2..cf62f7b 100644 --- a/tests/auto/symbols/tst_symbols.cpp +++ b/tests/auto/symbols/tst_symbols.cpp @@ -55,6 +55,8 @@ class tst_Symbols: public QObject { Q_OBJECT private slots: + void initTestCase(); + void prefix(); void globalObjects(); }; @@ -89,6 +91,12 @@ static QString symbolToLine(const QString &symbol, const QString &lib) return result; } +void tst_Symbols::initTestCase() +{ + QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR")); + QVERIFY2(!qtDir.isEmpty(), "This test needs $QTDIR"); +} + /* This test searches through all Qt libraries and searches for symbols starting with "global constructors keyed to " diff --git a/tests/benchmarks/corelib/io/qdir/tree/tree.pro b/tests/benchmarks/corelib/io/qdir/tree/tree.pro index 773f0f7..24a667e 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/tree.pro +++ b/tests/benchmarks/corelib/io/qdir/tree/tree.pro @@ -9,3 +9,8 @@ SOURCES += bench_qdir_tree.cpp RESOURCES += bench_qdir_tree.qrc QT -= gui + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro index e8014d6..6e823ff 100644 --- a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -4,3 +4,8 @@ TARGET = tst_bench_qthreadstorage SOURCES += tst_qthreadstorage.cpp QT -= gui + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/gui/gui.pro b/tests/benchmarks/gui/gui.pro index d825458..06828f4 100644 --- a/tests/benchmarks/gui/gui.pro +++ b/tests/benchmarks/gui/gui.pro @@ -12,7 +12,6 @@ SUBDIRS = \ TRUSTED_BENCHMARKS += \ graphicsview/functional/GraphicsViewBenchmark \ - graphicsview/qgraphicsview \ - painting/qtracebench + graphicsview/qgraphicsview -include(../trusted-benchmarks.pri)
\ No newline at end of file +include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro index e621d50..b242d60 100755 --- a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro @@ -11,3 +11,8 @@ CONFIG += release # Input SOURCES += main.cpp + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/network/network.pro b/tests/benchmarks/network/network.pro index 692a0a1..52817f9 100644 --- a/tests/benchmarks/network/network.pro +++ b/tests/benchmarks/network/network.pro @@ -6,8 +6,7 @@ SUBDIRS = \ socket TRUSTED_BENCHMARKS += \ - kernel/qhostinfo \ socket/qtcpserver \ ssl/qsslsocket -include(../trusted-benchmarks.pri)
\ No newline at end of file +include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro index 4bdfcb7..30b10d2 100644 --- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro +++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro @@ -12,4 +12,7 @@ CONFIG += release # Input SOURCES += tst_qtcpserver.cpp -symbian:TARGET.CAPABILITY += NetworkServices
\ No newline at end of file +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro index da34a02..85ca1e3 100644 --- a/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro +++ b/tests/benchmarks/network/ssl/qsslsocket/qsslsocket.pro @@ -11,3 +11,8 @@ CONFIG += release # Input SOURCES += tst_qsslsocket.cpp + +symbian: { + TARGET.CAPABILITY = NetworkServices + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE +} diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro index 5da05e7..3216b24 100644 --- a/tests/benchmarks/script/script.pro +++ b/tests/benchmarks/script/script.pro @@ -13,7 +13,6 @@ SUBDIRS = \ TRUSTED_BENCHMARKS += \ qscriptclass \ qscriptvalue \ - qscriptengine \ qscriptqobject include(../trusted-benchmarks.pri) |