2015-01-16 13:44:24 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2015-01-16 13:44:24 +01:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2015-01-16 13:44:24 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef TESTXMLOUTPUTREADER_H
|
|
|
|
|
#define TESTXMLOUTPUTREADER_H
|
|
|
|
|
|
2015-02-18 15:40:32 +01:00
|
|
|
#include "testresult.h"
|
2015-01-16 13:44:24 +01:00
|
|
|
|
2016-01-19 14:24:09 +01:00
|
|
|
#include <QFutureInterface>
|
2015-01-16 13:44:24 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
2016-01-20 08:26:10 +01:00
|
|
|
#include <QXmlStreamReader>
|
2015-01-16 13:44:24 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QProcess;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-12-09 09:46:33 +01:00
|
|
|
class TestOutputReader : public QObject
|
2015-01-16 13:44:24 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2016-01-19 14:24:09 +01:00
|
|
|
TestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
2016-01-26 17:24:11 +01:00
|
|
|
QProcess *testApplication, const QString &buildDirectory);
|
2016-01-20 08:26:10 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void processOutput() = 0;
|
|
|
|
|
QFutureInterface<TestResult *> m_futureInterface;
|
|
|
|
|
QProcess *m_testApplication; // not owned
|
2016-01-26 17:24:11 +01:00
|
|
|
QString m_buildDir;
|
2016-01-20 08:26:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QtTestOutputReader : public TestOutputReader
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QtTestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
2016-01-26 17:24:11 +01:00
|
|
|
QProcess *testApplication, const QString &buildDirectory);
|
2016-01-20 08:26:10 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void processOutput() override;
|
2015-12-09 09:46:33 +01:00
|
|
|
|
2016-01-19 14:24:09 +01:00
|
|
|
private:
|
2016-01-20 08:26:10 +01:00
|
|
|
enum CDATAMode
|
|
|
|
|
{
|
|
|
|
|
None,
|
|
|
|
|
DataTag,
|
|
|
|
|
Description,
|
|
|
|
|
QtVersion,
|
|
|
|
|
QtBuild,
|
|
|
|
|
QTestVersion
|
|
|
|
|
};
|
2015-09-23 07:47:12 +02:00
|
|
|
|
2016-01-20 08:26:10 +01:00
|
|
|
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;
|
2015-01-16 13:44:24 +01:00
|
|
|
};
|
|
|
|
|
|
2016-01-20 08:26:10 +01:00
|
|
|
class GTestOutputReader : public TestOutputReader
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
GTestOutputReader(QFutureInterface<TestResult *> futureInterface,
|
2016-01-26 17:24:11 +01:00
|
|
|
QProcess *testApplication, const QString &buildDirectory);
|
2016-01-20 08:26:10 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void processOutput() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_currentTestName;
|
|
|
|
|
QString m_currentTestSet;
|
|
|
|
|
QString m_description;
|
|
|
|
|
QByteArray m_unprocessed;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2015-01-16 13:44:24 +01:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|
|
|
|
|
|
2015-12-09 09:46:33 +01:00
|
|
|
#endif // TESTOUTPUTREADER_H
|