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
|
|
|
|
2016-02-02 18:26:51 +01:00
|
|
|
#pragma once
|
2010-03-03 18:05:37 +01:00
|
|
|
|
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 "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
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
2019-05-27 16:09:44 +02:00
|
|
|
Tasks 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 setDebugEnabled(bool);
|
|
|
|
|
|
2010-09-02 16:42:19 +02:00
|
|
|
signals:
|
|
|
|
|
void aboutToDeleteParser();
|
|
|
|
|
|
2016-01-29 16:38:37 +02:00
|
|
|
private:
|
2016-02-02 18:26:51 +01:00
|
|
|
void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines) override;
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
|
|
2018-06-14 20:57:35 +02:00
|
|
|
bool m_debug = false;
|
2010-03-03 18:05:37 +01:00
|
|
|
|
|
|
|
|
QString m_receivedStdErrChildLine;
|
|
|
|
|
QString m_receivedStdOutChildLine;
|
2019-05-27 16:09:44 +02:00
|
|
|
Tasks m_receivedTasks;
|
2010-03-03 18:05:37 +01:00
|
|
|
QString m_receivedOutput;
|
2020-03-31 11:55:48 +02:00
|
|
|
TestTerminator *m_terminator = nullptr;
|
2013-05-03 16:02:53 +02:00
|
|
|
|
|
|
|
|
friend class TestTerminator;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TestTerminator : public IOutputParser
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TestTerminator(OutputParserTester *t);
|
|
|
|
|
|
2016-02-02 18:26:51 +01:00
|
|
|
void stdOutput(const QString &line) override;
|
|
|
|
|
void stdError(const QString &line) override;
|
2013-05-03 16:02:53 +02:00
|
|
|
|
|
|
|
|
private:
|
2018-06-14 20:57:35 +02:00
|
|
|
OutputParserTester *m_tester = nullptr;
|
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
|