summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-14 15:34:35 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-16 11:31:37 (GMT)
commit1bcf16555604ed3f030e685da4c7a7257338c3cc (patch)
tree261e536929ccd0d455f639629b2e0cb07210c3c9 /tests
parent3f0a30213925932acbff0db697378ca2135f0998 (diff)
downloadQt-1bcf16555604ed3f030e685da4c7a7257338c3cc.zip
Qt-1bcf16555604ed3f030e685da4c7a7257338c3cc.tar.gz
Qt-1bcf16555604ed3f030e685da4c7a7257338c3cc.tar.bz2
Update the parallel test to do different counts of parallel tests
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qtcpsocket_stresstest/tst_qtcpsocket_stresstest.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/auto/qtcpsocket_stresstest/tst_qtcpsocket_stresstest.cpp b/tests/auto/qtcpsocket_stresstest/tst_qtcpsocket_stresstest.cpp
index b706b7f..aabadf7 100644
--- a/tests/auto/qtcpsocket_stresstest/tst_qtcpsocket_stresstest.cpp
+++ b/tests/auto/qtcpsocket_stresstest/tst_qtcpsocket_stresstest.cpp
@@ -64,6 +64,7 @@ private Q_SLOTS:
void blockingPipelined();
void blockingMultipleRequests();
void connectDisconnect();
+ void parallelConnectDisconnect_data();
void parallelConnectDisconnect();
};
@@ -225,15 +226,26 @@ void tst_QTcpSocket_stresstest::connectDisconnect()
}
}
+void tst_QTcpSocket_stresstest::parallelConnectDisconnect_data()
+{
+ QTest::addColumn<int>("parallelAttempts");
+ QTest::newRow("1") << 1;
+ QTest::newRow("2") << 2;
+ QTest::newRow("4") << 4;
+ QTest::newRow("5") << 5;
+ QTest::newRow("10") << 10;
+ QTest::newRow("25") << 25;
+}
+
void tst_QTcpSocket_stresstest::parallelConnectDisconnect()
{
QFETCH_GLOBAL(QString, hostname);
QFETCH_GLOBAL(int, port);
+ QFETCH(int, parallelAttempts);
- for (int i = 0; i < AttemptCount/4; ++i) {
+ for (int i = 0; i < AttemptCount/qMax(2, parallelAttempts/4); ++i) {
qDebug("Attempt %d", i);
- const int parallelAttempts = 6;
- QTcpSocket socket[parallelAttempts];
+ QTcpSocket *socket = new QTcpSocket[parallelAttempts];
for (int j = 0; j < parallelAttempts; ++j) {
socket[j].connectToHost(hostname, port);
@@ -256,6 +268,7 @@ void tst_QTcpSocket_stresstest::parallelConnectDisconnect()
if (done == parallelAttempts)
break;
}
+ delete[] socket;
QVERIFY2(!timeout.hasExpired(10000), "Timeout");
}
}