forked from qt-creator/qt-creator
TestOutputReader: Report results directly through a signal
Instead of using future interface. The advantage is that signal is delivered synchronously now, in contrary to when future interface was used - it was queued into main event loop. Change-Id: Ic3d521c324c56b249515713c39bd09b9a924b6d3 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -74,7 +74,7 @@ void TestOutputReader::reportCrash()
|
||||
TestResult result = createDefaultResult();
|
||||
result.setDescription(Tr::tr("Test executable crashed."));
|
||||
result.setResult(ResultType::MessageFatal);
|
||||
m_futureInterface.reportResult(result);
|
||||
emit newResult(result);
|
||||
}
|
||||
|
||||
void TestOutputReader::createAndReportResult(const QString &message, ResultType type)
|
||||
@@ -109,7 +109,7 @@ void TestOutputReader::reportResult(const TestResult &result)
|
||||
{
|
||||
if (m_sanitizerResult.isValid())
|
||||
sendAndResetSanitizerResult();
|
||||
m_futureInterface.reportResult(result);
|
||||
emit newResult(result);
|
||||
m_hadValidOutput = true;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ void TestOutputReader::sendAndResetSanitizerResult()
|
||||
}
|
||||
}
|
||||
|
||||
m_futureInterface.reportResult(m_sanitizerResult);
|
||||
emit newResult(m_sanitizerResult);
|
||||
m_hadValidOutput = true;
|
||||
m_sanitizerLines.clear();
|
||||
m_sanitizerResult = {};
|
||||
|
@@ -33,6 +33,7 @@ public:
|
||||
|
||||
void resetCommandlineColor();
|
||||
signals:
|
||||
void newResult(const TestResult &result);
|
||||
void newOutputLineAvailable(const QByteArray &outputLine, OutputChannel channel);
|
||||
protected:
|
||||
static Utils::FilePath constructSourceFilePath(const Utils::FilePath &base,
|
||||
|
@@ -72,8 +72,6 @@ TestRunner::TestRunner()
|
||||
|
||||
m_cancelTimer.setSingleShot(true);
|
||||
connect(&m_cancelTimer, &QTimer::timeout, this, [this] { cancelCurrent(Timeout); });
|
||||
connect(&m_futureWatcher, &QFutureWatcher<TestResult>::resultReadyAt,
|
||||
this, [this](int index) { emit testResultReady(m_futureWatcher.resultAt(index)); });
|
||||
connect(&m_futureWatcher, &QFutureWatcher<TestResult>::finished,
|
||||
this, &TestRunner::onFinished);
|
||||
connect(this, &TestRunner::requestStopTestRun,
|
||||
@@ -239,7 +237,7 @@ void TestRunner::scheduleNext()
|
||||
QTC_ASSERT(!m_currentOutputReader, delete m_currentOutputReader);
|
||||
m_currentOutputReader = m_currentConfig->createOutputReader(*m_fakeFutureInterface, m_currentProcess);
|
||||
QTC_ASSERT(m_currentOutputReader, onProcessDone(); return);
|
||||
|
||||
connect(m_currentOutputReader, &TestOutputReader::newResult, this, &TestRunner::testResultReady);
|
||||
connect(m_currentOutputReader, &TestOutputReader::newOutputLineAvailable,
|
||||
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
||||
|
||||
@@ -654,6 +652,7 @@ void TestRunner::debugTests()
|
||||
|
||||
if (useOutputProcessor) {
|
||||
TestOutputReader *outputreader = config->createOutputReader(*futureInterface, nullptr);
|
||||
connect(outputreader, &TestOutputReader::newResult, this, &TestRunner::testResultReady);
|
||||
outputreader->setId(inferior.command.executable().toString());
|
||||
connect(outputreader, &TestOutputReader::newOutputLineAvailable,
|
||||
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
||||
|
Reference in New Issue
Block a user