Fix sanity check of network test server
authorJason McDonald <jason.mcdonald@nokia.com>
Fri, 25 Nov 2011 07:04:12 +0000 (17:04 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 28 Nov 2011 07:13:41 +0000 (08:13 +0100)
commite15548d3e49a8937856c78d8e6c1133d46df57ee
tree009ed1d5d605848e71586c9929e0605953ad5d17
parentcbcdb5f4cf7e52c3e184d87cc8716d6a9dcc9728
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>
26 files changed:
tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp
tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp
tests/auto/integrationtests/networkselftest/tst_networkselftest.cpp
tests/auto/integrationtests/qnetworkaccessmanager_and_qprogressdialog/tst_qnetworkaccessmanager_and_qprogressdialog.cpp
tests/auto/network-settings.h
tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
tests/auto/network/access/qftp/tst_qftp.cpp
tests/auto/network/access/qhttp/tst_qhttp.cpp
tests/auto/network/access/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp
tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp
tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
tests/manual/network_stresstest/tst_network_stresstest.cpp
tests/manual/qnetworkreply/main.cpp