Windows: Fixed helper process finding in network tests
Helper processes were not found properly on all network tests when the test was run with "nmake check": - tst_qtcpsocket - tst_qtcpserver - tst_qnetworksession - tst_qnetworkreply Task-number: QTBUG-24199 Task-number: QTBUG-24203 Task-number: QTBUG-24226 Task-number: QTBUG-24231 Task-number: QTBUG-24232 Change-Id: Ia4451b5a5e3fe9f81aba3837baf8292411f995d8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
This commit is contained in:
parent
960f246ffc
commit
78a6447e31
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user