2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +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.
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
#ifndef OUTPUTPARSER_TESTER_H
|
|
|
|
|
#define OUTPUTPARSER_TESTER_H
|
|
|
|
|
|
2010-03-29 17:59:27 +02:00
|
|
|
#if defined(WITH_TESTS)
|
|
|
|
|
|
2010-03-03 18:05:37 +01:00
|
|
|
#include "projectexplorer_export.h"
|
2013-05-03 16:02:53 +02:00
|
|
|
|
2010-03-03 18:05:37 +01:00
|
|
|
#include "ioutputparser.h"
|
2013-05-03 16:02:53 +02:00
|
|
|
#include "metatypedeclarations.h"
|
|
|
|
|
#include "task.h"
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2013-05-03 16:02:53 +02:00
|
|
|
class TestTerminator;
|
|
|
|
|
|
2010-03-03 18:05:37 +01:00
|
|
|
class PROJECTEXPLORER_EXPORT OutputParserTester : public IOutputParser
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum Channel {
|
|
|
|
|
STDOUT,
|
|
|
|
|
STDERR
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
OutputParserTester();
|
|
|
|
|
|
2013-10-07 13:34:40 +02:00
|
|
|
// test functions:
|
2010-03-03 18:05:37 +01:00
|
|
|
void testParsing(const QString &lines, Channel inputChannel,
|
2010-03-12 13:53:00 +01:00
|
|
|
QList<Task> tasks,
|
2010-03-03 18:05:37 +01:00
|
|
|
const QString &childStdOutLines,
|
|
|
|
|
const QString &childStdErrLines,
|
|
|
|
|
const QString &outputLines);
|
2014-05-19 18:34:53 +03:00
|
|
|
void testTaskMangling(const Task &input,
|
|
|
|
|
const Task &output);
|
2010-03-03 18:05:37 +01:00
|
|
|
void testOutputMangling(const QString &input,
|
|
|
|
|
const QString &output);
|
|
|
|
|
|
|
|
|
|
void setDebugEnabled(bool);
|
|
|
|
|
|
|
|
|
|
void appendOutputParser(IOutputParser *parser);
|
|
|
|
|
|
2010-09-02 16:42:19 +02:00
|
|
|
signals:
|
|
|
|
|
void aboutToDeleteParser();
|
|
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
private:
|
2011-06-01 09:17:23 +00:00
|
|
|
void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
|
2015-04-20 17:13:45 +02:00
|
|
|
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines);
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
|
|
bool m_debug;
|
|
|
|
|
|
|
|
|
|
QString m_receivedStdErrChildLine;
|
|
|
|
|
QString m_receivedStdOutChildLine;
|
2010-03-12 13:53:00 +01:00
|
|
|
QList<Task> m_receivedTasks;
|
2010-03-03 18:05:37 +01:00
|
|
|
QString m_receivedOutput;
|
2013-05-03 16:02:53 +02:00
|
|
|
|
|
|
|
|
friend class TestTerminator;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TestTerminator : public IOutputParser
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TestTerminator(OutputParserTester *t);
|
|
|
|
|
|
|
|
|
|
void stdOutput(const QString &line);
|
|
|
|
|
void stdError(const QString &line);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
OutputParserTester *m_tester;
|
2010-03-03 18:05:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace ProjectExplorer
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(ProjectExplorer::OutputParserTester::Channel)
|
|
|
|
|
|
2010-03-29 17:59:27 +02:00
|
|
|
#endif
|
|
|
|
|
|
2010-03-03 18:05:37 +01:00
|
|
|
#endif // OUTPUTPARSER_TESTER_H
|