Commit Graph

102 Commits

Author SHA1 Message Date
João Abecasis
a1621d235d Change QVector's in-memory data layout
The new layout matches that of QByteArrayData and QStringData, except
for offset which is measured from the beginning of QVectorData, whereas
in those classes it (still?) references the end of the header data.

The new layout uses an extra member for storing an offset into the data,
which will allow introducing QVector::fromRawData, similar to the same
functionality already existing in QString and QByteArray.

By not using an actual array to index array members, we also steer clear
of GCC bug #43247:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247

Change-Id: I408915aacadf616b4633bbbf5cae1fc19e415087
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-22 17:37:29 +01:00
João Abecasis
31a0358afb Merge remote-tracking branch 'gerrit/master' into containers
Conflicts:
	src/corelib/tools/qbytearray.h

Change-Id: I03b1f3e05c9b7a45130887c522fcd9b7aa387129
2012-02-21 14:58:57 +01:00
João Abecasis
ebeebe2126 Have QVectorData::grow, take size of header w/ padding
This includes padding necessary to align the data array, but excludes the first
element as was done before. Size of header is the interesting piece of
information, anyway.

This simplifies calculations in a couple of places, harmonizes code with the
QRawVector fork and paves the way for further changes in QVector, namely the
memory layout.

When Q_ALIGNOF is not available, default to pointer-size alignment. This
should be honoured by malloc and won't trigger use of more expensive
aligned allocation.

Change-Id: I504022ac7595f69089cafd96e47a91b874d5771e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-20 17:52:27 +01:00
João Abecasis
fd96115ae8 QVector: always grow exponentially
For non-movable types (QTypeInfo<T>::isStatic), QVector would grow the
array linearly, and defer to qAllocMore otherwise. That property,
however, gives no indication as to how the vector will grow.

By forcing additional allocations for growing containers of such types,
this penalized exactly those objects which are more expensive to move.

We now let qAllocMore reign in growth decisions.

Change-Id: I843a89dcdc21d09868c6b62a846a7e1e4548e399
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-02-17 21:23:20 +01:00
Jędrzej Nowacki
1b23336a29 Use static-less QMetaType API in QVariant.
This patch improves performance when constructing a custom type in
a QVariant by ~ 7-20% (instructions count) depending on the type size
and metatype attributes.

Change-Id: Ic2707ff5abd689b66e23c1794f111504bf9b3b01
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-02-16 02:00:30 +01:00
Jędrzej Nowacki
214e031d56 Implement new static less API for QMetaType.
Currently QMetaType API contains almost only static methods. This works
nice until someone needs more information or needs to do more operations
on a type. In this case every function call has to do type dispatch.

This API allows to avoid redundant type dispatching, by caching a
type information in a QMetaType instance. It gives significant
performance boost especially for custom types (up to 9x).

Change-Id: I223d066268402e072e41ca1d0a3e7bc160655d7f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-02-16 02:00:15 +01:00
Jędrzej Nowacki
18965b1384 Add QMetaType::FirstCoreType enum value.
We should not assume that the first type id is 0.

Change-Id: I17ba6ba57e97ebd495904bfd11235fe458f214e5
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-02-16 01:56:05 +01:00
Robin Burchell
3af86043ba Add a testcase of a list of UUIDs in string form.
UUIDs are a good testcase, because the textual content is all fairly similar.
This also changes data generation to be a little neater now that we're starting
to get multiple pieces of data.

Change-Id: Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-14 02:48:35 +01:00
Andreas Holzammer
ef7fd67845 Replace Q_WS_WINCE against Q_OS_WINCE.
Window system Macros where deprecated so use
Q_OS_WINCE for now. This code will need
some refactoring, but this is the first
step to it.

Change-Id: I5876b80ee45d4b38ac63fc7d51e775dc70bbd485
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-02-09 10:45:38 +01:00
João Abecasis
d065dfd454 Merge remote-tracking branch 'gerrit/master' into containers
Conflicts:
	src/corelib/tools/qstring.cpp

Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
2012-02-05 21:26:33 +01:00
Sergio Ahumada
d1950d8e52 tests: do not run benchmarks by default in 'make check'
`make check' is intended primarily for running functional tests.
For the most part, it does not make sense to run benchmarks in the same
test environment as the functional tests.

Change-Id: I79f867fdab295bdbd4c4b3c785dfd7ede520022e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-02-02 09:27:25 +01:00
Thorbjørn Lund Martsum
9fa4e51dbb Adding a QHeaderView benchmark
This is a small QHeaderView benchmark.

It measures visualIndexAt, hideSection, showSecion, moveSection,
insert, remove and trunc rows.

Change-Id: Ibca6a2e130f4ab27d68f51e5e341a78579abd1bf
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-02-01 10:59:40 +01:00
João Abecasis
2bf186a2e5 Allow function types to be registered without workarounds
Commit 4b8ceb41ae added the requirement
that pointed-to types need to be registered when registering pointer
types. Unfortunately, the implementation also affects function pointer
types.

This change whitelists 0, 1, 2 and 3 argument functions as not deriving
from QObject, forgoing the need to workaround details of the type
registration implementation when registering those function pointer
types.

Change-Id: I4d855e9d70a8179a6e31b84623ad5bf063e0d6d8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-01-31 16:17:55 +01:00
aavit
4fce5d1795 Moving tiff image format support and libtiff out of qtbase
The tiff plugin and bundled libtiff is moving to the qtimageformats
project on Gerrit.

Task-number: QTBUG-23887
Change-Id: I4c848232fdccddd7e7f54215f9eaa78dc4c3a53d
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-31 14:31:04 +01:00
Xizhi Zhu
ba9302b8a9 Remove Symbian specific code from qtbase.
Change-Id: I27d37d914b71e1e43c94e2a975ffec49e1ecd456
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-31 07:08:31 +01:00
Jason McDonald
e03386945f Update contact address in license headers.
Change-Id: I35bf916087511f26bfeb49ceb3256d9a20fbc1c0
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-31 04:54:56 +01:00
Jason McDonald
5635823e17 Remove "All rights reserved" line from license headers.
As in the past, to avoid rewriting various autotests that contain
line-number information, an extra blank line has been inserted at the
end of the license text to ensure that this commit does not change the
total number of lines in the license header.

Change-Id: I311e001373776812699d6efc045b5f742890c689
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-30 03:54:59 +01:00
Giuseppe D'Angelo
e1149349c1 QHash benchmark: improve Java's hash
Added a bit of documentation to the Java-like hashing function.

Change-Id: I3f44eee305d91b76f0f89cd1acf21f6430b9482b
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-01-27 22:48:12 +01:00
Giuseppe D'Angelo
071561f0eb QHash benchmark: remove unused variables
Change-Id: Ib5abc171fb8fb70e2f73ac92ca22dc09146d8a55
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-01-27 22:48:12 +01:00
Andrew den Exter
4dae8c1aff Remove QTextControl and QLineControl.
QtWidgets and QtDeclarative now both have their own versions of these
so there's no need to keep them around any longer.

Change-Id: I9c2201c8495a0a0816e2af16c8f647fcad991479
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-25 22:35:12 +01:00
Jędrzej Nowacki
aee1f6cc41 Cleanup mess in public type ids.
There is no reason to keep two separated core types sets. It
couldn't be fixed before Qt5 because of binary compatibility promise.

This patch merges QMetaType core types with ext core types.

This "simple" operation consists of:
- QDataStream version was incremented, because type ids are
saved in QVariant's data stream.
- QMetaType LastExtCoreType and FirstExtCoreType were replaced by
LastCoreType, FirstCoreType and new QMetaType::HighestInternalId.
- New tests checking QVariant data stream for Qt4 and for Qt5 versions
were added.

Change-Id: I02dd74d29317365c297a789a4eb7c9c5edc3b231
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-25 21:08:08 +01:00
Gunnar Sletta
4ecf82795d Remove use of QT_MODULE from library
These defines were there to aid in the commercial
licensing scheme we used long ago, and are no longer needed.

Keep a QT_MODULE(x) define so other modules continue compiling.

Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-25 10:19:44 +01:00
aavit
48f9ba388b Remove support for the MNG file format and the bundled libmng
The MNG file format is generally abandoned, and libmng has been
unmaintained for several years.

The MNG plugin and bundled libmng has been moved to the
qtimageformats project on Gerrit.

Task-number: QTBUG-21869
Change-Id: I946432347014ffde2b72307a5f8b166ca5553602
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-01-25 02:22:18 +01:00
Lars Knoll
37a7b035f8 Import json support from playground/qtbinaryjson
This imports the JSON support for Qt 5 from
playground/qtbinaryjson.

It adds a fast, fully compliant json parser, a
convenient C++ API, conversion to and from
QVariants and a binary format for JSON that is
extremely fast to use together with the C++ API.

Change-Id: If9e3a21a4241d388d0abaa446b6824f9cc6edb1c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-24 15:28:20 +01:00
Stephen Kelly
4b8ceb41ae Store the is-a QObject fact with the metatype declaration.
This is a source incompatible change for Q_DECLARE_METATYPE(T*),
which now requires T to be fully defined.

The consequences of this are:
 * Forward declared types can no longer be declared as a metatype.
     (though this is a very uncommon thing to do).

There is a trivial workaround where necessary.

Change-Id: Id74c40088b8c0b466fcd7c55abd616f69acc82c8
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-01-24 15:27:25 +01:00
Robin Burchell
1806ea8dd9 Add the capability to use multiple data sources for qhash benchmark.
More data sources to be added in followup commits.

Change-Id: I0393119b36ac5d88fc2c5c8d46b000d13d5ca996
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-01-24 01:09:05 +01:00
Robin Burchell
47d0813f5b Remove executive summary.
It isn't necessarily that hashing the whole string is the main problem, as the
recently added java string benchmark appears to show, which means the original
purpose of this benchmark is rather voided.

This removal allows gradually repurposing the test towards providing general
benchmarks of QHash performance.

Change-Id: Iaab0a3b493387dcce99240632342235ed9c44d88
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-24 01:09:01 +01:00
Robin Burchell
f61112aa32 Move test files around.
main.cpp is easier for my muscle memory to remember than qhash_string as it is
used by a number of other tests.

Change-Id: I044f995d55a4ff1328dde0ae27b6e36a80114c38
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-01-24 01:08:55 +01:00
Jason McDonald
629d6eda5c Update contact information in license headers.
Replace Nokia contact email address with Qt Project website.

Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-23 04:04:33 +01:00
Robin Burchell
4ed85ba43f Introduce a qalgorithms benchmark.
Based on the unit test for data production.

Change-Id: I88a411c0079b251d3682c3fbf9fe7ed1b5457a7e
Reviewed-by: Anselmo L. S. Melo <anselmo.melo@openbossa.org>
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-01-21 14:29:49 +01:00
Robin Burchell
8060dd3c42 Add a string hash implementation similar to the one in Java.
This uses a similar runtime to the approach of sampling part of the string, with
the benefit that it doesn't reduce the sampling to subsections of the string.

Ironically, Java used to only sample parts of the string as well, but found that
it produced too many collisions with certain string types, so they moved to use
this method.

RESULT : tst_QHash::qhash_qt4():
     0.0537 msecs per iteration (total: 110, iterations: 2048)
PASS   : tst_QHash::qhash_qt4()
RESULT : tst_QHash::qhash_faster():
     0.015 msecs per iteration (total: 62, iterations: 4096)
PASS   : tst_QHash::qhash_faster()
RESULT : tst_QHash::javaString():
     0.016 msecs per iteration (total: 66, iterations: 4096)

Change-Id: Icb5da341ab6445163f4217650a0bdb3903e50210
Reviewed-by: hjk <qthjk@ovi.com>
2012-01-20 12:42:27 +01:00
João Abecasis
5b250d497f Merge remote-tracking branch 'gerrit/master' into containers
Change-Id: I2d358b912f1055ee6021d13de2f66fd459aaa355
2012-01-16 17:53:41 +01:00
João Abecasis
cb0cdf6c08 Use RefCount::setSharable feature in QVector
Note: This constitutes a break in Binary Compatibility.

Change-Id: I050587901725b701f20dd46475ae48aec28aa54d
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-10 14:43:15 +01:00
Jason McDonald
5313c28b30 Update year in Nokia copyright headers.
The previous change missed some headers from years prior to 2011, and a
few new files were merged after the previous change.

Change-Id: Ib7d1a2b7062228c2a5373da64242b2ee1f0981e1
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-10 07:12:41 +01:00
Liang Qi
8c72dc5907 Add V3(md5) and V5(sha1) version for DCE in QUuid
Add the above versions based on RFC4122 standard.

Done-with: Hagen Rother
Task-number: QTBUG-23071
Change-Id: Ieb90925374d1e3c85011b899b8dd3bb1a608c561
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
2012-01-10 05:12:20 +01:00
Jason McDonald
4c66ab91a9 Remove execute permission from files that don't need it.
Change-Id: Ib92875289cdd9831f35301c566fb567acc725bb6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-01-10 01:24:22 +01:00
Stephen Kelly
7aeccb183a Remove the Q_TYPENAME define.
It is mostly not used (most places in Qt use typename directly), so
is already not very useful.

For example typename is used in:

QDataStream& operator<<(QDataStream& s, const QVector<T>& v)

Change-Id: I85337ad7d8d4ebbb424bfa2ab9a356456ff3e90f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-08 23:54:56 +01:00
Robin Burchell
b08daaedd4 Remove all non-inline of qMalloc/qFree/qRealloc.
We're trying to deprecate these, so don't use them anymore.

The inline uses of these have been left intact, for the moment. Inline code will
need to create their own non-inline allocation methods (for future-proofing to
allow alterations in how e.g. individual containers allocate)

Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-01-06 14:11:14 +01:00
Jason McDonald
1fdfc2abfe Update copyright year in license headers.
Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-01-05 06:36:56 +01:00
João Abecasis
7fadc3ce32 Get rid of assignment operators in RefCount
, and make it strictly a POD struct.

Since this operator was only being used to set the initial (owned) value
of the reference count, the name of the function introduced here to
replace it makes that use case explicit.

Change-Id: I2feadd2ac35dcb75ca211471baf5044a5f57cd62
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-01-04 23:37:58 +01:00
Robin Burchell
69a44f9cfc Change event posting to use a QVector.
This provides a ~10% improvement to the newly introduced QCoreApplication
event_posting_benchmark (a simple synthetic benchmark of creating a bunch of
events, posting them, and sending the queue).

before:
********* Start testing of QCoreApplicationBenchmark *********
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS   : QCoreApplicationBenchmark::initTestCase()
RESULT : QCoreApplicationBenchmark::signal_slot_benchmark():"1000":
     0.82 msecs per iteration (total: 53, iterations: 64)
RESULT : QCoreApplicationBenchmark::signal_slot_benchmark():"10000":
     8.6 msecs per iteration (total: 69, iterations: 8)
RESULT : QCoreApplicationBenchmark::signal_slot_benchmark():"100000":
     84 msecs per iteration (total: 84, iterations: 1)
RESULT : QCoreApplicationBenchmark::signal_slot_benchmark():"1000000":
     874 msecs per iteration (total: 874, iterations: 1)
PASS   : QCoreApplicationBenchmark::signal_slot_benchmark()
PASS   : QCoreApplicationBenchmark::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of QCoreApplicationBenchmark *********

after:
********* Start testing of QCoreApplicationBenchmark *********
Config: Using QTest library 5.0.0, Qt 5.0.0
PASS   : QCoreApplicationBenchmark::initTestCase()
RESULT : QCoreApplicationBenchmark::event_posting_benchmark():"1000 events":
     0.781 msecs per iteration (total: 100, iterations: 128)
RESULT : QCoreApplicationBenchmark::event_posting_benchmark():"10000 events":
     7.8 msecs per iteration (total: 63, iterations: 8)
RESULT : QCoreApplicationBenchmark::event_posting_benchmark():"100000 events":
     75 msecs per iteration (total: 75, iterations: 1)
RESULT : QCoreApplicationBenchmark::event_posting_benchmark():"1000000 events":
     774 msecs per iteration (total: 774, iterations: 1)
PASS   : QCoreApplicationBenchmark::event_posting_benchmark()
PASS   : QCoreApplicationBenchmark::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of QCoreApplicationBenchmark *********

Change-Id: Ibf56d9526b0a8cbaf171008da4104bb457628172
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-30 21:58:10 +01:00
Konstantin Ritt
ebe43992f9 add tests and benchmarks for QString::toLower()/toUpper()/toCaseFolded()
Merge-request: 70
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>

Change-Id: I3929d4d8963c3cef6d2c6420d8ad1f7a45f7e042
Reviewed-by: Olivier
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2011-12-25 21:58:57 +01:00
Bradley T. Hughes
cd796404f1 Reimplement QIODevice::reset() properly
The reset() function is not const.

tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp:324:
warning: 'FixedSizeDataGenerator::reset' hides overloaded virtual
function [-Woverloaded-virtual]
    virtual bool reset() const{
                 ^
src/corelib/io/qiodevice.h:112: hidden overloaded virtual function
'QIODevice::reset' declared here
    virtual bool reset();
                 ^

Change-Id: I022d902147f9c8fb71bee8c3e21b963b2d7bec55
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2011-12-21 20:32:42 +01:00
Bradley T. Hughes
103c2e3690 Reimplement QVariantAnimation::updateState() properly
The updateState() takes 2 arguments, not 1.

tests/benchmarks/gui/animation/qanimation/dummyanimation.h:54: warning:
'DummyAnimation::updateState' hides overloaded virtual function
[-Woverloaded-virtual]
    void updateState(State state);
         ^
src/corelib/animation/qvariantanimation.h:106: hidden overloaded virtual
function 'QVariantAnimation::updateState' declared here
    void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
         ^

Change-Id: Ieb2e4e0b1f017c51c4fed5bdb874ba30cb056916
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2011-12-21 20:32:31 +01:00
Jason McDonald
e3640d1bdd Remove TESTED_CLASS/TESTED_FILES comments from tests.
These comments were mostly empty or inaccurate.  Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.

Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-06 02:19:25 +01:00
Friedemann Kleint
98ebac7ede Fix compilation of Benchmark tests on Windows.
Change-Id: I92186f916792d110f22b23525b673ef006e19046
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-01 09:05:12 +01:00
Olivier Goffart
fad19e18af Benchmark the new signal slot connection syntax.
- Added emition of a slot connected using the new syntax, as well as a
   functor

 - Replaced the old connect_disconnect_benchmark by a new one. The old
   one was of little interest as it tried to connect to every signal,
   producing a lot of similar results.
   The new test tests different ways of connecting and disconnecting

Change-Id: I3c04c24027252308f8942bcd9562110104cdb4e9
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-11-30 01:04:34 +01:00
Friedemann Kleint
5943874eb1 Fix compilation of some benchmark tests on Windows.
Change-Id: Iab6b83f3d4693a3b5deaaf88043dde75a84866fd
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-11-29 08:52:59 +01:00
Jason McDonald
e15548d3e4 Fix sanity check of network test server
Some of Qt's autotests depend on access to a test server.  For each test
that used the test server, tests/auto/network-settings.h created a
global object to verify at startup that host lookups to the test server
will succeed (and abort the test otherwise).

There are two problems with that approach:

First, the sanity check happens before main(), and thus before the test
framework has started logging test results.  This means that if the
sanity check aborts the test, the failure message will not be visible in
the test output if logging to a file or will cause the output to be
malformed if logging to the console in XML format.

Second, since Qt 4.7, the host lookup uses a class that connects to the
QCoreApplication instance, which doesn't exist before main(), and this
caused all tests that included network-settings.h to output an error
message from QObject::connect() at the beginning of the test.

Both of these problems are solved by removing the global object from
network-settings.h and instead performing the sanity check in the
initTestCase() function of each test.

Task-number: QTBUG-22876
Change-Id: Id49c1826906327bf571686cc11527f0265e5af44
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 08:13:41 +01:00
Jason McDonald
a8fd0c3654 Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are
compiler builtins) and does not correctly evaluate others that depend
on compiler builtins, such as Q_OS_FOO.

This commit reverts parts of the following commits, but is not a
complete fix as there were many instances of this problem in the tests
prior to those commits:
    924d810dbd
    8aaff67510
    338d3f1197
    a55034062b
    253497b744
    7cfad460c5
    9d2ff58f36
    0cf6baa2d6

Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 01:51:57 +01:00