2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-03-03 18:05:37 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/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
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt 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);
|
2010-03-12 13:53:00 +01: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
|