Work around test failure for pixmap cache.
authorGlenn Watson <glenn.watson@nokia.com>
Thu, 28 Jun 2012 01:11:05 +0000 (11:11 +1000)
committerQt by Nokia <qt-info@nokia.com>
Sun, 1 Jul 2012 22:08:23 +0000 (00:08 +0200)
A deadlock condition can occur in the qtbase network management
code. Added a work around for the bug, and marked the test as
significant for CI on Ubuntu 10.04 LTS.

Task-number: QTBUG-25307
Change-Id: I6c11645d29dfd34b564f0a811c6f3470b8f31312
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
tests/auto/quick/qquickpixmapcache/qquickpixmapcache.pro
tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp

index 03d7eef..185eb2c 100644 (file)
@@ -14,6 +14,4 @@ TESTDATA = data/*
 # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
 # LIBS += -lgcov
 
-linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = lucid ]"):CONFIG += insignificant_test # QTBUG-25307
-
 QT += core-private gui-private qml-private quick-private network testlib concurrent
index 8d2eb66..fb2405c 100644 (file)
@@ -46,6 +46,7 @@
 #include <QNetworkReply>
 #include "../../shared/util.h"
 #include "testhttpserver.h"
+#include <QtNetwork/QNetworkConfigurationManager>
 
 #ifndef QT_NO_CONCURRENT
 #include <qtconcurrentrun.h>
@@ -110,10 +111,17 @@ static const bool localfile_optimized = true;
 static const bool localfile_optimized = false;
 #endif
 
-
 void tst_qquickpixmapcache::initTestCase()
 {
     QQmlDataTest::initTestCase();
+
+    // This avoids a race condition/deadlock bug in network config
+    // manager when it is accessed by the HTTP server thread before
+    // anything else. Bug report can be found at:
+    // https://bugreports.qt-project.org/browse/QTBUG-26355
+    QNetworkConfigurationManager cm;
+    cm.updateConfigurations();
+
     server.serveDirectory(testFile("http"));
 }
 
@@ -274,7 +282,7 @@ void tst_qquickpixmapcache::parallel()
         if (i == cancel) {
             QVERIFY(!getters[i]->gotslot);
         } else {
-            if (pending[i]) 
+            if (pending[i])
                 QVERIFY(getters[i]->gotslot);
 
             QVERIFY(pixmap->isReady());