path: root/tests/benchmarks/network/ssl
diff options
authorJason McDonald <>2011-11-25 17:04:12 +1000
committerQt by Nokia <>2011-11-28 08:13:41 +0100
commite15548d3e49a8937856c78d8e6c1133d46df57ee (patch)
tree009ed1d5d605848e71586c9929e0605953ad5d17 /tests/benchmarks/network/ssl
parentcbcdb5f4cf7e52c3e184d87cc8716d6a9dcc9728 (diff)
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 <>
Diffstat (limited to 'tests/benchmarks/network/ssl')
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
index aa4d014687..9f0a694b9a 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -61,7 +61,7 @@ public:
public slots:
- void initTestCase_data();
+ void initTestCase();
void init();
void cleanup();
private slots:
@@ -77,8 +77,9 @@ tst_QSslSocket::~tst_QSslSocket()
-void tst_QSslSocket::initTestCase_data()
+void tst_QSslSocket::initTestCase()
+ QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
void tst_QSslSocket::init()