diff options
4 files changed, 44 insertions, 11 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 0e9136dbc7..866afbf0a5 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -135,6 +135,7 @@ class tst_QNetworkReply: public QObject enum RunSimpleRequestReturn { Timeout = 0, Success, Failure }; int returnCode; QString testFileName; + QString echoProcessDir; #if !defined Q_OS_WIN QString wronlyFileName; #endif @@ -1308,6 +1309,10 @@ void tst_QNetworkReply::initTestCase() QVERIFY(networkSession->waitForOpened(30000)); } #endif + + echoProcessDir = QFINDTESTDATA("echo"); + QVERIFY2(!echoProcessDir.isEmpty(), qPrintable( + QString::fromLatin1("Couldn't find echo dir starting from %1.").arg(QDir::currentPath()))); } void tst_QNetworkReply::cleanupTestCase() @@ -3849,7 +3854,10 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QFETCH(QByteArray, data); QProcess process; - process.start("echo/echo all"); + QString echoExe = echoProcessDir + "/echo"; + process.start(echoExe, QStringList("all")); + QVERIFY2(process.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(echoExe, process.errorString()))); process.write(data); process.closeWriteChannel(); diff --git a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp index a51b4e5632..27e1e7f013 100644 --- a/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/network/bearer/qnetworksession/test/tst_qnetworksession.cpp @@ -96,6 +96,7 @@ private slots: private: QNetworkConfigurationManager manager; int inProcessSessionManagementCount; + QString lackeyDir; #endif }; @@ -117,6 +118,10 @@ void tst_QNetworkSession::initTestCase() QSignalSpy spy(&manager, SIGNAL(updateCompleted())); manager.updateConfigurations(); QTRY_VERIFY_WITH_TIMEOUT(spy.count() == 1, TestTimeOut); + + lackeyDir = QFINDTESTDATA("lackey"); + QVERIFY2(!lackeyDir.isEmpty(), qPrintable( + QString::fromLatin1("Couldn't find lackey dir starting from %1.").arg(QDir::currentPath()))); } void tst_QNetworkSession::cleanupTestCase() @@ -916,10 +921,10 @@ void tst_QNetworkSession::outOfProcessSession() oopServer.listen("tst_qnetworksession"); QProcess lackey; - lackey.start("lackey/lackey"); - qDebug() << lackey.error() << lackey.errorString(); - QVERIFY(lackey.waitForStarted()); - + QString lackeyExe = lackeyDir + "/lackey"; + lackey.start(lackeyExe); + QVERIFY2(lackey.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(lackeyExe, lackey.errorString()))); QVERIFY(oopServer.waitForNewConnection(-1)); QLocalSocket *oopSocket = oopServer.nextPendingConnection(); diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index 941e0b2142..ac27a621bb 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -119,6 +119,7 @@ private: #ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; #endif + QString crashingServerDir; }; // Testing get/set functions @@ -150,6 +151,10 @@ void tst_QTcpServer::initTestCase_data() QTest::newRow("WithoutProxy") << false << 0; QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); + + crashingServerDir = QFINDTESTDATA("crashingServer"); + QVERIFY2(!crashingServerDir.isEmpty(), qPrintable( + QString::fromLatin1("Couldn't find crashingServer dir starting from %1.").arg(QDir::currentPath()))); } void tst_QTcpServer::initTestCase() @@ -538,7 +543,10 @@ void tst_QTcpServer::addressReusable() QFile::remove(signalName); // The crashingServer process will crash once it gets a connection. QProcess process; - process.start("crashingServer/crashingServer"); + QString processExe = crashingServerDir + "/crashingServer"; + process.start(processExe); + QVERIFY2(process.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); int waitCount = 5; while (waitCount-- && !QFile::exists(signalName)) QTest::qWait(1000); @@ -547,7 +555,10 @@ void tst_QTcpServer::addressReusable() #else // The crashingServer process will crash once it gets a connection. QProcess process; - process.start("crashingServer/crashingServer"); + QString processExe = crashingServerDir + "/crashingServer"; + process.start(processExe); + QVERIFY2(process.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(processExe, process.errorString()))); QVERIFY(process.waitForReadyRead(5000)); #endif diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 829ddd2054..abeb1ed06d 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -246,6 +246,7 @@ private: SocketPair *earlyConstructedSockets; int earlyBytesWrittenCount; int earlyReadyReadCount; + QString stressTestDir; }; enum ProxyTests { @@ -340,6 +341,10 @@ void tst_QTcpSocket::initTestCase_data() QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true; // QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true; #endif + + stressTestDir = QFINDTESTDATA("stressTest"); + QVERIFY2(!stressTestDir.isEmpty(), qPrintable( + QString::fromLatin1("Couldn't find stressTest dir starting from %1.").arg(QDir::currentPath()))); } void tst_QTcpSocket::initTestCase() @@ -2225,11 +2230,14 @@ void tst_QTcpSocket::suddenRemoteDisconnect() if (ssl) return; + QString processExe = stressTestDir + "/stressTest"; + // Start server QProcess serverProcess; serverProcess.setReadChannel(QProcess::StandardError); - serverProcess.start(QString::fromLatin1("stressTest/stressTest %1").arg(server), - QIODevice::ReadWrite | QIODevice::Text); + serverProcess.start(processExe, QStringList(server), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(serverProcess.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString()))); while (!serverProcess.canReadLine()) QVERIFY(serverProcess.waitForReadyRead(10000)); QCOMPARE(serverProcess.readLine().data(), (server.toLatin1() + "\n").data()); @@ -2237,8 +2245,9 @@ void tst_QTcpSocket::suddenRemoteDisconnect() // Start client QProcess clientProcess; clientProcess.setReadChannel(QProcess::StandardError); - clientProcess.start(QString::fromLatin1("stressTest/stressTest %1").arg(client), - QIODevice::ReadWrite | QIODevice::Text); + clientProcess.start(processExe, QStringList(client), QIODevice::ReadWrite | QIODevice::Text); + QVERIFY2(clientProcess.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(processExe, clientProcess.errorString()))); while (!clientProcess.canReadLine()) QVERIFY(clientProcess.waitForReadyRead(10000)); QCOMPARE(clientProcess.readLine().data(), (client.toLatin1() + "\n").data()); |