tst_QProcess: Transform loop into additional test rows

Do not use a loop to execute similar but separate tests in
tst_QProcess::softExitInSlots. Use separate test rows with
distinguishable data tags instead.
This way we can deduce from CI output which part of this test failed.

Change-Id: Ic9bc996f2ced11b2bb1c33c1970e64937d860976
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Joerg Bornemann 2016-02-24 12:22:46 +01:00
parent 9e59174b49
commit 479167cd4e

View File

@ -1050,24 +1050,33 @@ private:
void tst_QProcess::softExitInSlots_data()
{
QTest::addColumn<QString>("appName");
QTest::addColumn<int>("signalToConnect");
QByteArray dataTagPrefix("gui app ");
#ifndef QT_NO_WIDGETS
QTest::newRow("gui app") << "testGuiProcess/testGuiProcess";
for (int i = 0; i < 5; ++i) {
QTest::newRow(dataTagPrefix + QByteArray::number(i))
<< "testGuiProcess/testGuiProcess" << i;
}
#endif
QTest::newRow("console app") << "testProcessEcho2/testProcessEcho2";
dataTagPrefix = "console app ";
for (int i = 0; i < 5; ++i) {
QTest::newRow(dataTagPrefix + QByteArray::number(i))
<< "testProcessEcho2/testProcessEcho2" << i;
}
}
void tst_QProcess::softExitInSlots()
{
QFETCH(QString, appName);
QFETCH(int, signalToConnect);
for (int i = 0; i < 5; ++i) {
SoftExitProcess proc(i);
proc.writeAfterStart("OLEBOLE", 8); // include the \0
proc.start(appName);
QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
QCOMPARE(proc.state(), QProcess::NotRunning);
}
SoftExitProcess proc(signalToConnect);
proc.writeAfterStart("OLEBOLE", 8); // include the \0
proc.start(appName);
QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000);
QCOMPARE(proc.state(), QProcess::NotRunning);
}
#endif