forked from qt-creator/qt-creator
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:
@@ -51,10 +51,8 @@ BoostTestOutputReader::BoostTestOutputReader(const QFutureInterface<TestResultPt
|
|||||||
, m_logLevel(log)
|
, m_logLevel(log)
|
||||||
, m_reportLevel(report)
|
, m_reportLevel(report)
|
||||||
{
|
{
|
||||||
if (m_testApplication) {
|
if (m_testApplication)
|
||||||
connect(m_testApplication, &Utils::QtcProcess::finished,
|
connect(m_testApplication, &Utils::QtcProcess::done, this, &BoostTestOutputReader::onDone);
|
||||||
this, &BoostTestOutputReader::onFinished);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// content of "error:..." / "info:..." / ... messages
|
// content of "error:..." / "info:..." / ... messages
|
||||||
@@ -406,7 +404,7 @@ TestResultPtr BoostTestOutputReader::createDefaultResult() const
|
|||||||
return TestResultPtr(result);
|
return TestResultPtr(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoostTestOutputReader::onFinished() {
|
void BoostTestOutputReader::onDone() {
|
||||||
int exitCode = m_testApplication->exitCode();
|
int exitCode = m_testApplication->exitCode();
|
||||||
if (m_reportLevel == ReportLevel::No && m_testCaseCount != -1) {
|
if (m_reportLevel == ReportLevel::No && m_testCaseCount != -1) {
|
||||||
int reportedFailsAndSkips = m_summary[ResultType::Fail] + m_summary[ResultType::Skip];
|
int reportedFailsAndSkips = m_summary[ResultType::Fail] + m_summary[ResultType::Skip];
|
||||||
|
@@ -47,7 +47,7 @@ protected:
|
|||||||
TestResultPtr createDefaultResult() const override;
|
TestResultPtr createDefaultResult() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onFinished();
|
void onDone();
|
||||||
void sendCompleteInformation();
|
void sendCompleteInformation();
|
||||||
void handleMessageMatch(const QRegularExpressionMatch &match);
|
void handleMessageMatch(const QRegularExpressionMatch &match);
|
||||||
void reportNoOutputFinish(const QString &description, ResultType type);
|
void reportNoOutputFinish(const QString &description, ResultType type);
|
||||||
|
@@ -45,9 +45,8 @@ GTestOutputReader::GTestOutputReader(const QFutureInterface<TestResultPtr> &futu
|
|||||||
, m_projectFile(projectFile)
|
, m_projectFile(projectFile)
|
||||||
{
|
{
|
||||||
if (m_testApplication) {
|
if (m_testApplication) {
|
||||||
connect(m_testApplication, &Utils::QtcProcess::finished,
|
connect(m_testApplication, &Utils::QtcProcess::done, this, [this] {
|
||||||
this, [this]() {
|
const int exitCode = m_testApplication->exitCode();
|
||||||
int exitCode = m_testApplication->exitCode();
|
|
||||||
if (exitCode == 1 && !m_description.isEmpty()) {
|
if (exitCode == 1 && !m_description.isEmpty()) {
|
||||||
createAndReportResult(tr("Running tests failed.\n %1\nExecutable: %2")
|
createAndReportResult(tr("Running tests failed.\n %1\nExecutable: %2")
|
||||||
.arg(m_description).arg(id()), ResultType::MessageFatal);
|
.arg(m_description).arg(id()), ResultType::MessageFatal);
|
||||||
|
@@ -197,7 +197,7 @@ bool TestRunner::currentConfigValid()
|
|||||||
m_fakeFutureInterface->reportFinished();
|
m_fakeFutureInterface->reportFinished();
|
||||||
onFinished();
|
onFinished();
|
||||||
} else {
|
} else {
|
||||||
onProcessFinished();
|
onProcessDone();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -263,21 +263,20 @@ void TestRunner::scheduleNext()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_currentConfig->project())
|
if (!m_currentConfig->project())
|
||||||
onProcessFinished();
|
onProcessDone();
|
||||||
|
|
||||||
setUpProcess();
|
setUpProcess();
|
||||||
QTC_ASSERT(m_currentProcess, onProcessFinished(); return);
|
QTC_ASSERT(m_currentProcess, onProcessDone(); return);
|
||||||
QTC_ASSERT(!m_currentOutputReader, delete m_currentOutputReader);
|
QTC_ASSERT(!m_currentOutputReader, delete m_currentOutputReader);
|
||||||
m_currentOutputReader = m_currentConfig->outputReader(*m_fakeFutureInterface, m_currentProcess);
|
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,
|
connect(m_currentOutputReader, &TestOutputReader::newOutputLineAvailable,
|
||||||
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
||||||
|
|
||||||
setUpProcessEnv();
|
setUpProcessEnv();
|
||||||
|
|
||||||
connect(m_currentProcess, &Utils::QtcProcess::finished,
|
connect(m_currentProcess, &Utils::QtcProcess::done, this, &TestRunner::onProcessDone);
|
||||||
this, &TestRunner::onProcessFinished);
|
|
||||||
const int timeout = AutotestPlugin::settings()->timeout;
|
const int timeout = AutotestPlugin::settings()->timeout;
|
||||||
m_cancelTimer.setInterval(timeout);
|
m_cancelTimer.setInterval(timeout);
|
||||||
m_cancelTimer.start();
|
m_cancelTimer.start();
|
||||||
@@ -292,7 +291,7 @@ void TestRunner::scheduleNext()
|
|||||||
reportResult(ResultType::MessageFatal,
|
reportResult(ResultType::MessageFatal,
|
||||||
tr("Failed to start test for project \"%1\".").arg(m_currentConfig->displayName())
|
tr("Failed to start test for project \"%1\".").arg(m_currentConfig->displayName())
|
||||||
+ processInformation(m_currentProcess) + rcInfo(m_currentConfig));
|
+ 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) {
|
if (m_executingTests && m_currentConfig) {
|
||||||
QTC_CHECK(m_fakeFutureInterface);
|
QTC_CHECK(m_fakeFutureInterface);
|
||||||
|
@@ -90,7 +90,7 @@ private:
|
|||||||
void setUpProcessEnv();
|
void setUpProcessEnv();
|
||||||
void scheduleNext();
|
void scheduleNext();
|
||||||
void cancelCurrent(CancelReason reason);
|
void cancelCurrent(CancelReason reason);
|
||||||
void onProcessFinished();
|
void onProcessDone();
|
||||||
void resetInternalPointers();
|
void resetInternalPointers();
|
||||||
|
|
||||||
void runTests();
|
void runTests();
|
||||||
|
Reference in New Issue
Block a user