AutoTest: Connect to done() signal instead of finished()

QtcProcess::done() is also emitted when process failed to start.

Change-Id: I08f6f104014d1c90c0f761de352dada620207d86
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Jarek Kobus
2022-06-20 11:45:36 +02:00
parent 5f53b983ff
commit 425a0c8835
5 changed files with 14 additions and 18 deletions

View File

@@ -51,10 +51,8 @@ BoostTestOutputReader::BoostTestOutputReader(const QFutureInterface<TestResultPt
, m_logLevel(log)
, m_reportLevel(report)
{
if (m_testApplication) {
connect(m_testApplication, &Utils::QtcProcess::finished,
this, &BoostTestOutputReader::onFinished);
}
if (m_testApplication)
connect(m_testApplication, &Utils::QtcProcess::done, this, &BoostTestOutputReader::onDone);
}
// content of "error:..." / "info:..." / ... messages
@@ -406,7 +404,7 @@ TestResultPtr BoostTestOutputReader::createDefaultResult() const
return TestResultPtr(result);
}
void BoostTestOutputReader::onFinished() {
void BoostTestOutputReader::onDone() {
int exitCode = m_testApplication->exitCode();
if (m_reportLevel == ReportLevel::No && m_testCaseCount != -1) {
int reportedFailsAndSkips = m_summary[ResultType::Fail] + m_summary[ResultType::Skip];

View File

@@ -47,7 +47,7 @@ protected:
TestResultPtr createDefaultResult() const override;
private:
void onFinished();
void onDone();
void sendCompleteInformation();
void handleMessageMatch(const QRegularExpressionMatch &match);
void reportNoOutputFinish(const QString &description, ResultType type);

View File

@@ -45,9 +45,8 @@ GTestOutputReader::GTestOutputReader(const QFutureInterface<TestResultPtr> &futu
, m_projectFile(projectFile)
{
if (m_testApplication) {
connect(m_testApplication, &Utils::QtcProcess::finished,
this, [this]() {
int exitCode = m_testApplication->exitCode();
connect(m_testApplication, &Utils::QtcProcess::done, this, [this] {
const int exitCode = m_testApplication->exitCode();
if (exitCode == 1 && !m_description.isEmpty()) {
createAndReportResult(tr("Running tests failed.\n %1\nExecutable: %2")
.arg(m_description).arg(id()), ResultType::MessageFatal);

View File

@@ -197,7 +197,7 @@ bool TestRunner::currentConfigValid()
m_fakeFutureInterface->reportFinished();
onFinished();
} else {
onProcessFinished();
onProcessDone();
}
return false;
}
@@ -263,21 +263,20 @@ void TestRunner::scheduleNext()
return;
if (!m_currentConfig->project())
onProcessFinished();
onProcessDone();
setUpProcess();
QTC_ASSERT(m_currentProcess, onProcessFinished(); return);
QTC_ASSERT(m_currentProcess, onProcessDone(); return);
QTC_ASSERT(!m_currentOutputReader, delete m_currentOutputReader);
m_currentOutputReader = m_currentConfig->outputReader(*m_fakeFutureInterface, m_currentProcess);
QTC_ASSERT(m_currentOutputReader, onProcessFinished();return);
QTC_ASSERT(m_currentOutputReader, onProcessDone();return);
connect(m_currentOutputReader, &TestOutputReader::newOutputLineAvailable,
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
setUpProcessEnv();
connect(m_currentProcess, &Utils::QtcProcess::finished,
this, &TestRunner::onProcessFinished);
connect(m_currentProcess, &Utils::QtcProcess::done, this, &TestRunner::onProcessDone);
const int timeout = AutotestPlugin::settings()->timeout;
m_cancelTimer.setInterval(timeout);
m_cancelTimer.start();
@@ -292,7 +291,7 @@ void TestRunner::scheduleNext()
reportResult(ResultType::MessageFatal,
tr("Failed to start test for project \"%1\".").arg(m_currentConfig->displayName())
+ processInformation(m_currentProcess) + rcInfo(m_currentConfig));
onProcessFinished();
onProcessDone();
}
}
@@ -315,7 +314,7 @@ void TestRunner::cancelCurrent(TestRunner::CancelReason reason)
}
}
void TestRunner::onProcessFinished()
void TestRunner::onProcessDone()
{
if (m_executingTests && m_currentConfig) {
QTC_CHECK(m_fakeFutureInterface);

View File

@@ -90,7 +90,7 @@ private:
void setUpProcessEnv();
void scheduleNext();
void cancelCurrent(CancelReason reason);
void onProcessFinished();
void onProcessDone();
void resetInternalPointers();
void runTests();