summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-19 02:50:38 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-19 02:50:38 (GMT)
commit0f01ad8c73e352a8368296820f4dd77f9da06114 (patch)
treebdee720f7f004a7dae4c7a52d07317c0f8926056
parent14866f7fd79f39c2f20f5e0149fe6e11d7121d70 (diff)
parent85b82c845c32d383cdb9ec9f6ac21a0e86e4308a (diff)
downloadQt-0f01ad8c73e352a8368296820f4dd77f9da06114.zip
Qt-0f01ad8c73e352a8368296820f4dd77f9da06114.tar.gz
Qt-0f01ad8c73e352a8368296820f4dd77f9da06114.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Moving QDir benchmarks; making way for new test cases Fixing QDir benchmarks... QTreeView: Fix premature pessimization Simplify code, fix a compiler warning... profit! tst_qnetworkreply: Add another testcase QNAM HTTP: Clean code a bit QNAM HTTP: Always set channel.reply to 0 when done Revert "Added note to make QList destructor virtual in version 5" Fix s390(x) atomic ops related crashes Fix undefined sequence point compiler warning
-rw-r--r--src/corelib/arch/qatomic_s390.h16
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/gui/itemviews/qtreeview.cpp9
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp12
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp22
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h5
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp77
-rw-r--r--src/network/access/qhttpnetworkreply.cpp13
-rw-r--r--src/network/access/qhttpnetworkreply_p.h2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp66
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/10000.pro10
-rw-r--r--tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp (renamed from tests/benchmarks/corelib/io/qdir/tst_qdir.cpp)10
-rw-r--r--tests/benchmarks/corelib/io/qdir/qdir.pro10
13 files changed, 170 insertions, 84 deletions
diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h
index 21f5037..273c17b 100644
--- a/src/corelib/arch/qatomic_s390.h
+++ b/src/corelib/arch/qatomic_s390.h
@@ -366,11 +366,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr",
- "", "bcr 15,0\n");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr",
- "", "bcr 15,0\n");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "");
#endif
}
@@ -378,9 +376,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr", "", "");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "bcr 15,0 \n");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr", "", "");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "bcr 15,0 \n");
#endif
}
@@ -388,11 +386,9 @@ template <typename T>
Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
{
#ifndef __s390x__
- return (T*)__CS_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (int)newValue, "lr",
- "bcr 15,0 \n", "");
+ return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "bcr 15,0 \n", "");
#else
- return (T*)__CSG_OLD_LOOP(reinterpret_cast<volatile long*>(_q_value), (long)newValue, "lgr",
- "bcr 15,0\n", "");
+ return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "bcr 15,0\n", "");
#endif
}
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index a549f2f..1ad7528 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -112,7 +112,7 @@ class QList
public:
inline QList() : d(&QListData::shared_null) { d->ref.ref(); }
inline QList(const QList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach_helper(); }
- ~QList(); // ### Qt5: make this destructor virtual
+ ~QList();
QList<T> &operator=(const QList<T> &l);
bool operator==(const QList<T> &l) const;
inline bool operator!=(const QList<T> &l) const { return !(*this == l); }
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index d0fa22d..706d2a8 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2474,10 +2474,11 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end)
QVector<QTreeViewItem> insertedItems(delta);
for (int i = 0; i < delta; ++i) {
- insertedItems[i].index = d->model->index(i + start, 0, parent);
- insertedItems[i].level = childLevel;
- insertedItems[i].hasChildren = d->hasVisibleChildren(insertedItems[i].index);
- insertedItems[i].hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1));
+ QTreeViewItem &item = insertedItems[i];
+ item.index = d->model->index(i + start, 0, parent);
+ item.level = childLevel;
+ item.hasChildren = d->hasVisibleChildren(item.index);
+ item.hasMoreSiblings = !((i == delta - 1) && (parentRowCount == end +1));
}
if (d->viewItems.isEmpty())
d->defaultItemHeight = indexRowSizeHint(insertedItems[0].index);
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 7412b06..c9a94ee 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -210,13 +210,11 @@ bool QSoftKeyManager::handleUpdateSoftKeys()
d->requestedSoftKeyActions.clear();
bool recursiveMerging = false;
QWidget *source = softkeySource(NULL, recursiveMerging);
- do {
- if (source) {
- bool added = appendSoftkeys(*source, level);
- source = softkeySource(source, recursiveMerging);
- level = added ? ++level : level;
- }
- } while (source);
+ while (source) {
+ if (appendSoftkeys(*source, level))
+ ++level;
+ source = softkeySource(source, recursiveMerging);
+ }
d->updateSoftKeys_sys();
return true;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index cc6a1c8..62aa2d7 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -404,6 +404,7 @@ QHttpNetworkReply* QHttpNetworkConnectionPrivate::queueRequest(const QHttpNetwor
QHttpNetworkReply *reply = new QHttpNetworkReply(request.url());
reply->setRequest(request);
reply->d_func()->connection = q;
+ reply->d_func()->connectionChannel = &channels[0]; // will have the correct one set later
HttpMessagePair pair = qMakePair(request, reply);
switch (request.priority()) {
@@ -688,14 +689,12 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
if (channels[i].resendCurrent) {
channels[i].resendCurrent = false;
channels[i].state = QHttpNetworkConnectionChannel::IdleState;
- if (channels[i].reply) {
- // if this is not possible, error will be emitted and connection terminated
- if (!channels[i].resetUploadData())
- continue;
+ // if this is not possible, error will be emitted and connection terminated
+ if (!channels[i].resetUploadData())
+ continue;
- channels[i].sendRequest();
- }
+ channels[i].sendRequest();
}
}
@@ -861,17 +860,6 @@ QNetworkProxy QHttpNetworkConnection::transparentProxy() const
// SSL support below
#ifndef QT_NO_OPENSSL
-QSslConfiguration QHttpNetworkConnectionPrivate::sslConfiguration(const QHttpNetworkReply &reply) const
-{
- if (!encrypt)
- return QSslConfiguration();
-
- for (int i = 0; i < channelCount; ++i)
- if (channels[i].reply == &reply)
- return static_cast<QSslSocket *>(channels[0].socket)->sslConfiguration();
- return QSslConfiguration(); // pending or done request
-}
-
void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config)
{
Q_D(QHttpNetworkConnection);
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 03cf09c..823774e 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -210,11 +210,6 @@ public:
void emitReplyError(QAbstractSocket *socket, QHttpNetworkReply *reply, QNetworkReply::NetworkError errorCode);
bool handleAuthenticateChallenge(QAbstractSocket *socket, QHttpNetworkReply *reply, bool isProxy, bool &resend);
-
-#ifndef QT_NO_OPENSSL
- QSslConfiguration sslConfiguration(const QHttpNetworkReply &reply) const;
-#endif
-
#ifndef QT_NO_NETWORKPROXY
QNetworkProxy networkProxy;
void emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth);
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 2a3036b..dbee72a 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -124,6 +124,13 @@ void QHttpNetworkConnectionChannel::close()
bool QHttpNetworkConnectionChannel::sendRequest()
{
+ if (!reply) {
+ // heh, how should that happen!
+ qWarning() << "QHttpNetworkConnectionChannel::sendRequest() called without QHttpNetworkReply";
+ state = QHttpNetworkConnectionChannel::IdleState;
+ return false;
+ }
+
switch (state) {
case QHttpNetworkConnectionChannel::IdleState: { // write the header
if (!ensureConnection()) {
@@ -134,13 +141,13 @@ bool QHttpNetworkConnectionChannel::sendRequest()
}
written = 0; // excluding the header
bytesTotal = 0;
- if (reply) {
- reply->d_func()->clear();
- reply->d_func()->connection = connection;
- reply->d_func()->autoDecompress = request.d->autoDecompress;
- reply->d_func()->pipeliningUsed = false;
- }
- state = QHttpNetworkConnectionChannel::WritingState;
+
+ reply->d_func()->clear();
+ reply->d_func()->connection = connection;
+ reply->d_func()->connectionChannel = this;
+ reply->d_func()->autoDecompress = request.d->autoDecompress;
+ reply->d_func()->pipeliningUsed = false;
+
pendingEncrypt = false;
// if the url contains authentication parameters, use the new ones
// both channels will use the new authentication parameters
@@ -174,13 +181,15 @@ bool QHttpNetworkConnectionChannel::sendRequest()
QObject::connect(uploadByteDevice, SIGNAL(readyRead()),this, SLOT(_q_uploadDataReadyRead()));
bytesTotal = request.contentLength();
+
+ state = QHttpNetworkConnectionChannel::WritingState; // start writing data
+ sendRequest(); //recurse
} else {
- state = QHttpNetworkConnectionChannel::WaitingState;
- sendRequest();
- break;
+ state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
+ sendRequest(); //recurse
}
- // write the initial chunk together with the headers
- // fall through
+
+ break;
}
case QHttpNetworkConnectionChannel::WritingState:
{
@@ -190,7 +199,7 @@ bool QHttpNetworkConnectionChannel::sendRequest()
if (uploadByteDevice)
emit reply->dataSendProgress(written, bytesTotal);
state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
- sendRequest();
+ sendRequest(); // recurse
break;
}
@@ -278,16 +287,25 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
{
Q_ASSERT(socket);
+ if (!reply) {
+ // heh, how should that happen!
+ qWarning() << "QHttpNetworkConnectionChannel::_q_receiveReply() called without QHttpNetworkReply,"
+ << socket->bytesAvailable() << "bytes on socket.";
+ close();
+ return;
+ }
+
qint64 bytes = 0;
QAbstractSocket::SocketState socketState = socket->state();
// connection might be closed to signal the end of data
if (socketState == QAbstractSocket::UnconnectedState) {
if (socket->bytesAvailable() <= 0) {
- if (reply && reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
+ if (reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingDataState) {
// finish this reply. this case happens when the server did not send a content length
reply->d_func()->state = QHttpNetworkReplyPrivate::AllDoneState;
allDone();
+ return;
} else {
handleUnexpectedEOF();
return;
@@ -299,12 +317,13 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
// read loop for the response
while (socket->bytesAvailable()) {
- QHttpNetworkReplyPrivate::ReplyState state = reply ? reply->d_func()->state : QHttpNetworkReplyPrivate::AllDoneState;
+ QHttpNetworkReplyPrivate::ReplyState state = reply->d_func()->state;
switch (state) {
case QHttpNetworkReplyPrivate::NothingDoneState: {
// only eat whitespace on the first call
eatWhitespace();
state = reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState;
+ // fallthrough
}
case QHttpNetworkReplyPrivate::ReadingStatusState: {
qint64 statusBytes = reply->d_func()->readStatus(socket);
@@ -412,8 +431,10 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
#endif
}
}
+ // still in ReadingDataState? This function will be called again by the socket's readyRead
if (replyPrivate->state == QHttpNetworkReplyPrivate::ReadingDataState)
break;
+
// everything done, fall through
}
case QHttpNetworkReplyPrivate::AllDoneState:
@@ -568,7 +589,8 @@ void QHttpNetworkConnectionChannel::allDone()
handleStatus();
// ### at this point there should be no more data on the socket
// close if server requested
- if (reply->d_func()->isConnectionCloseEnabled())
+ bool connectionCloseEnabled = reply->d_func()->isConnectionCloseEnabled();
+ if (connectionCloseEnabled)
close();
// queue the finished signal, this is required since we might send new requests from
// slot connected to it. The socket will not fire readyRead signal, if we are already
@@ -579,14 +601,22 @@ void QHttpNetworkConnectionChannel::allDone()
// in case of failures, each channel will attempt two reconnects before emitting error.
reconnectAttempts = 2;
+ detectPipeliningSupport();
+
// now the channel can be seen as free/idle again, all signal emissions for the reply have been done
this->state = QHttpNetworkConnectionChannel::IdleState;
- detectPipeliningSupport();
+ // if it does not need to be sent again we can set it to 0
+ // the previous code did not do that and we had problems with accidental re-sending of a
+ // finished request.
+ // Note that this may trigger a segfault at some other point. But then we can fix the underlying
+ // problem.
+ if (!resendCurrent)
+ reply = 0;
// move next from pipeline to current request
if (!alreadyPipelinedRequests.isEmpty()) {
- if (resendCurrent || reply->d_func()->isConnectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) {
+ if (resendCurrent || connectionCloseEnabled || socket->state() != QAbstractSocket::ConnectedState) {
// move the pipelined ones back to the main queue
requeueCurrentlyPipelinedRequests();
close();
@@ -742,12 +772,11 @@ void QHttpNetworkConnectionChannel::pipelineInto(HttpMessagePair &pair)
QHttpNetworkRequest &request = pair.first;
QHttpNetworkReply *reply = pair.second;
- if (reply) {
- reply->d_func()->clear();
- reply->d_func()->connection = connection;
- reply->d_func()->autoDecompress = request.d->autoDecompress;
- reply->d_func()->pipeliningUsed = true;
- }
+ reply->d_func()->clear();
+ reply->d_func()->connection = connection;
+ reply->d_func()->connectionChannel = this;
+ reply->d_func()->autoDecompress = request.d->autoDecompress;
+ reply->d_func()->pipeliningUsed = true;
#ifndef QT_NO_NETWORKPROXY
QByteArray header = QHttpNetworkRequestPrivate::header(request,
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 512c045..984f557 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -230,6 +230,7 @@ void QHttpNetworkReplyPrivate::clear()
currentChunkRead = 0;
connectionCloseEnabled = true;
connection = 0;
+ connectionChannel = 0;
#ifndef QT_NO_COMPRESS
if (initInflate)
inflateEnd(&inflateStrm);
@@ -803,9 +804,15 @@ void QHttpNetworkReplyPrivate::eraseData()
QSslConfiguration QHttpNetworkReply::sslConfiguration() const
{
Q_D(const QHttpNetworkReply);
- if (d->connection)
- return d->connection->d_func()->sslConfiguration(*this);
- return QSslConfiguration();
+
+ if (!d->connectionChannel)
+ return QSslConfiguration();
+
+ QSslSocket *sslSocket = qobject_cast<QSslSocket*>(d->connectionChannel->socket);
+ if (!sslSocket)
+ return QSslConfiguration();
+
+ return sslSocket->sslConfiguration();
}
void QHttpNetworkReply::setSslConfiguration(const QSslConfiguration &config)
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index af9266b..fa240ec 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -86,6 +86,7 @@ static const unsigned char gz_magic[2] = {0x1f, 0x8b}; // gzip magic header
QT_BEGIN_NAMESPACE
class QHttpNetworkConnection;
+class QHttpNetworkConnectionChannel;
class QHttpNetworkRequest;
class QHttpNetworkConnectionPrivate;
class QHttpNetworkReplyPrivate;
@@ -218,6 +219,7 @@ public:
qint64 currentChunkSize;
qint64 currentChunkRead;
QPointer<QHttpNetworkConnection> connection;
+ QPointer<QHttpNetworkConnectionChannel> connectionChannel;
bool initInflate;
bool streamEnd;
#ifndef QT_NO_COMPRESS
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 5fecc86..049bbb8 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -257,6 +257,8 @@ private Q_SLOTS:
void httpConnectionCount();
+ void httpRecursiveCreation();
+
#ifndef QT_NO_OPENSSL
void ioPostToHttpsUploadProgress();
void ignoreSslErrorsList_data();
@@ -3788,6 +3790,70 @@ void tst_QNetworkReply::httpConnectionCount()
#endif
}
+class HttpRecursiveCreationHelper : public QObject {
+ Q_OBJECT
+public:
+
+ HttpRecursiveCreationHelper():
+ QObject(0),
+ requestsStartedCount_finished(0),
+ requestsStartedCount_readyRead(0),
+ requestsFinishedCount(0)
+ {
+ }
+ QNetworkAccessManager manager;
+ int requestsStartedCount_finished;
+ int requestsStartedCount_readyRead;
+ int requestsFinishedCount;
+public slots:
+ void finishedSlot() {
+ requestsFinishedCount++;
+
+ QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
+ QVERIFY(!reply->error());
+ QVERIFY(reply->bytesAvailable() == 27906);
+
+ if (requestsFinishedCount == 60) {
+ QTestEventLoop::instance().exitLoop();
+ return;
+ }
+
+ if (requestsStartedCount_finished < 30) {
+ startOne();
+ requestsStartedCount_finished++;
+ }
+
+ reply->deleteLater();
+ }
+ void readyReadSlot() {
+ QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
+ QVERIFY(!reply->error());
+
+ if (requestsStartedCount_readyRead < 30 && reply->bytesAvailable() > 27906/2) {
+ startOne();
+ requestsStartedCount_readyRead++;
+ }
+ }
+ void startOne() {
+ QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif";
+ QNetworkRequest request(url);
+ QNetworkReply *reply = manager.get(request);
+ reply->setParent(this);
+ connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));
+ connect(reply, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ }
+};
+
+void tst_QNetworkReply::httpRecursiveCreation()
+{
+ // this test checks if creation of new requests to the same host properly works
+ // from readyRead() and finished() signals
+ HttpRecursiveCreationHelper helper;
+ helper.startOne();
+ QTestEventLoop::instance().enterLoop(30);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+}
+
#ifndef QT_NO_OPENSSL
void tst_QNetworkReply::ignoreSslErrorsList_data()
{
diff --git a/tests/benchmarks/corelib/io/qdir/10000/10000.pro b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
new file mode 100644
index 0000000..93b0992
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qdir/10000/10000.pro
@@ -0,0 +1,10 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = bench_qdir_10000
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += bench_qdir_10000.cpp
+
+QT -= gui
diff --git a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp
index aea9fd0..b325250 100644
--- a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp
@@ -50,7 +50,7 @@
# include <unistd.h>
#endif
-class Test : public QObject{
+class bench_QDir_10000 : public QObject{
Q_OBJECT
public slots:
void initTestCase() {
@@ -95,9 +95,9 @@ private slots:
QBENCHMARK {
QDirIterator dit(testdir.path(), QDir::Files);
while (dit.hasNext()) {
+ dit.next();
dit.fileInfo().isDir();
dit.fileInfo().size();
- dit.next();
}
}
}
@@ -116,9 +116,9 @@ private slots:
QBENCHMARK {
QDirIterator dit(testdir.path());
while (dit.hasNext()) {
+ dit.next();
dit.fileInfo().isDir();
dit.fileInfo().size();
- dit.next();
}
}
}
@@ -194,5 +194,5 @@ private slots:
}
};
-QTEST_MAIN(Test)
-#include "tst_qdir.moc"
+QTEST_MAIN(bench_QDir_10000)
+#include "bench_qdir_10000.moc"
diff --git a/tests/benchmarks/corelib/io/qdir/qdir.pro b/tests/benchmarks/corelib/io/qdir/qdir.pro
index 2cdebfd..c572566 100644
--- a/tests/benchmarks/corelib/io/qdir/qdir.pro
+++ b/tests/benchmarks/corelib/io/qdir/qdir.pro
@@ -1,8 +1,2 @@
-load(qttest_p4)
-TEMPLATE = app
-TARGET = tst_qdir
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += tst_qdir.cpp
+TEMPLATE = subdirs
+SUBDIRS = 10000