Commit 166bf38a authored by Christian Stenger's avatar Christian Stenger
Browse files

Fix issue with manually canceling running tests...



...by restructuring TestOutputReader.

Change-Id: Ia58b755a5b50afb66d53e9d254e450cce01621f4
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent e60a7a69
This diff is collapsed.
......@@ -25,6 +25,7 @@
#include <QFutureInterface>
#include <QObject>
#include <QString>
#include <QXmlStreamReader>
QT_BEGIN_NAMESPACE
class QProcess;
......@@ -38,16 +39,63 @@ class TestOutputReader : public QObject
Q_OBJECT
public:
TestOutputReader(QFutureInterface<TestResult *> futureInterface,
QProcess *testApplication, TestType type);
QProcess *testApplication);
protected:
virtual void processOutput() = 0;
QFutureInterface<TestResult *> m_futureInterface;
QProcess *m_testApplication; // not owned
};
class QtTestOutputReader : public TestOutputReader
{
public:
QtTestOutputReader(QFutureInterface<TestResult *> futureInterface,
QProcess *testApplication);
protected:
void processOutput() override;
private:
void processOutput();
void processGTestOutput();
enum CDATAMode
{
None,
DataTag,
Description,
QtVersion,
QtBuild,
QTestVersion
};
QProcess *m_testApplication; // not owned
QFutureInterface<TestResult *> m_futureInterface;
CDATAMode m_cdataMode = None;
QString m_className;
QString m_testCase;
QString m_dataTag;
Result::Type m_result = Result::Invalid;
QString m_description;
QString m_file;
int m_lineNumber = 0;
QString m_duration;
QXmlStreamReader m_xmlReader;
};
class GTestOutputReader : public TestOutputReader
{
public:
GTestOutputReader(QFutureInterface<TestResult *> futureInterface,
QProcess *testApplication);
protected:
void processOutput() override;
private:
QString m_currentTestName;
QString m_currentTestSet;
QString m_description;
QByteArray m_unprocessed;
};
} // namespace Internal
} // namespace Autotest
......
......@@ -135,8 +135,15 @@ static void performTestRun(QFutureInterface<TestResult *> &futureInterface,
futureInterface.setProgressValue(0);
foreach (const TestConfiguration *testConfiguration, selectedTests) {
TestOutputReader outputReader(futureInterface, &testProcess, testConfiguration->testType());
Q_UNUSED(outputReader);
QScopedPointer<TestOutputReader> outputReader;
switch (testConfiguration->testType()) {
case TestTypeQt:
outputReader.reset(new QtTestOutputReader(futureInterface, &testProcess));
break;
case TestTypeGTest:
outputReader.reset(new GTestOutputReader(futureInterface, &testProcess));
break;
}
if (futureInterface.isCanceled())
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment