summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-04-17 15:59:16 +0200
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2015-11-03 15:33:53 +0000
commit8e43f25edd8546b30cab5ae9884107b36445a86f (patch)
tree753bb208049507cb4d83d9260d3b752f9a91277d /tests/auto/network/access
parent8c2ca33073f20e1fe552bd8b5f663aec5b8a634d (diff)
tst_QNetworkReply::ioGetFromBuiltinHttp - fix for large kernel buffers
On some platforms our 1200 x 1000 bytes seems to be not enough to fill kernel buffers (socket write). But it's not a reason to fail test, just skip it. Task-number:QTBUG-49205 Change-Id: I13ea6f315f9318288ba054cf8bfa6cdd61e489d2 Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'tests/auto/network/access')
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index e68a52c032..a84d290661 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -199,6 +199,7 @@ public Q_SLOTS:
protected Q_SLOTS:
void nestedEventLoops_slot();
+ void notEnoughData();
private Q_SLOTS:
void init();
@@ -487,6 +488,7 @@ private Q_SLOTS:
void parentingRepliesToTheApp();
private:
QString testDataDir;
+ bool notEnoughDataForFastSender;
};
bool tst_QNetworkReply::seedCreated = false;
@@ -991,11 +993,13 @@ public:
}
// a server that sends the data provided at construction time, useful for HTTP
- FastSender(const QByteArray& data, bool https, bool fillBuffer)
+ FastSender(const QByteArray& data, bool https, bool fillBuffer, tst_QNetworkReply *listener = 0)
: wantedSize(data.size()), port(-1), protocol(ProvidedData),
doSsl(https), fillKernelBuffer(fillBuffer), transferRate(-1),
dataToTransmit(data), dataIndex(0)
{
+ if (listener)
+ connect(this, SIGNAL(notEnoughData()), listener, SLOT(notEnoughData()));
start();
ready.acquire();
}
@@ -1058,6 +1062,7 @@ protected:
do {
if (writeNextData(client, BlockSize) < BlockSize) {
qDebug() << "ERROR: FastSender: not enough data to write in order to fill buffers; or client is reading too fast";
+ emit notEnoughData();
return;
}
while (client->bytesToWrite() > 0) {
@@ -1118,6 +1123,7 @@ protected:
}
signals:
void dataReady();
+ void notEnoughData();
};
class RateControlledReader: public QObject
@@ -4901,7 +4907,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
<< testData.size() << "bytes of data";
const bool fillKernelBuffer = bufferSize > 0;
- FastSender server(httpResponse, https, fillKernelBuffer);
+ notEnoughDataForFastSender = false;
+ FastSender server(httpResponse, https, fillKernelBuffer, this);
QUrl url(QString("%1://127.0.0.1:%2/qtest/rfc3252.txt")
.arg(https?"https":"http")
@@ -4916,7 +4923,13 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
QTime loopTime;
loopTime.start();
- QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply));
+ const int result = waitForFinish(reply);
+ if (notEnoughDataForFastSender) {
+ server.wait();
+ QSKIP("kernel socket buffers are too big for this test to work");
+ }
+
+ QVERIFY2(result == Success, msgWaitForFinished(reply));
const int elapsedTime = loopTime.elapsed();
server.wait();
@@ -5589,6 +5602,11 @@ void tst_QNetworkReply::nestedEventLoops_slot()
QTestEventLoop::instance().exitLoop();
}
+void tst_QNetworkReply::notEnoughData()
+{
+ notEnoughDataForFastSender = true;
+}
+
void tst_QNetworkReply::nestedEventLoops()
{
// Slightly fragile test, it may not be testing anything