2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
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();
|
|
|
|
|
|
2010-03-03 18:05:37 +01:00
|
|
|
private slots:
|
2011-06-01 09:17:23 +00:00
|
|
|
void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
|
2010-03-12 13:53:00 +01:00
|
|
|
void taskAdded(const ProjectExplorer::Task &task);
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
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
|