Make tst_qnetworkreply parallel-safe.

Ensure we always use a unique filename when writing to test files.
The test already contained code for this, but it was not applied in a
couple of places.

Change-Id: I1e29ee162c390e014688ab46e3658e2a463d203e
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
This commit is contained in:
Rohan McGovern 2012-05-29 09:33:15 +10:00 committed by Qt by Nokia
parent 5bd5f6ae69
commit c68f4367f6
2 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,5 @@
CONFIG += testcase CONFIG += testcase
CONFIG += parallel_test
QT -= gui QT -= gui
SOURCES += ../tst_qnetworkreply.cpp SOURCES += ../tst_qnetworkreply.cpp
TARGET = ../tst_qnetworkreply TARGET = ../tst_qnetworkreply

View File

@ -1125,8 +1125,8 @@ tst_QNetworkReply::tst_QNetworkReply()
#endif #endif
qRegisterMetaType<QNetworkReply::NetworkError>(); qRegisterMetaType<QNetworkReply::NetworkError>();
testFileName = QDir::currentPath() + "/testfile";
uniqueExtension = createUniqueExtension(); uniqueExtension = createUniqueExtension();
testFileName = QDir::currentPath() + "/testfile" + uniqueExtension;
cookieJar = new MyCookieJar; cookieJar = new MyCookieJar;
manager.setCookieJar(cookieJar); manager.setCookieJar(cookieJar);
@ -1351,7 +1351,7 @@ void tst_QNetworkReply::initTestCase()
QVERIFY(QtNetworkSettings::verifyTestNetworkSettings()); QVERIFY(QtNetworkSettings::verifyTestNetworkSettings());
#if !defined Q_OS_WIN #if !defined Q_OS_WIN
wronlyFileName = testDataDir + "/write-only"; wronlyFileName = testDataDir + "/write-only" + uniqueExtension;
QFile wr(wronlyFileName); QFile wr(wronlyFileName);
QVERIFY(wr.open(QIODevice::WriteOnly | QIODevice::Truncate)); QVERIFY(wr.open(QIODevice::WriteOnly | QIODevice::Truncate));
wr.setPermissions(QFile::WriteOwner | QFile::WriteUser); wr.setPermissions(QFile::WriteOwner | QFile::WriteUser);