forked from qt-creator/qt-creator
ValgrindRunner: Hide ThreadedParser
Expose its signals instead. Change-Id: I0daeb2e510c30678f4f13d880bc8108510c4f32e Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -175,7 +175,7 @@ void MemcheckToolRunner::start()
|
|||||||
|
|
||||||
void MemcheckToolRunner::stop()
|
void MemcheckToolRunner::stop()
|
||||||
{
|
{
|
||||||
disconnect(m_runner.parser(), &ThreadedParser::internalError,
|
disconnect(&m_runner, &ValgrindRunner::internalError,
|
||||||
this, &MemcheckToolRunner::internalParserError);
|
this, &MemcheckToolRunner::internalParserError);
|
||||||
ValgrindToolRunner::stop();
|
ValgrindToolRunner::stop();
|
||||||
}
|
}
|
||||||
@@ -1154,8 +1154,7 @@ MemcheckToolRunner::MemcheckToolRunner(RunControl *runControl)
|
|||||||
m_localServerAddress(QHostAddress::LocalHost)
|
m_localServerAddress(QHostAddress::LocalHost)
|
||||||
{
|
{
|
||||||
setId("MemcheckToolRunner");
|
setId("MemcheckToolRunner");
|
||||||
connect(m_runner.parser(), &XmlProtocol::ThreadedParser::error,
|
connect(&m_runner, &ValgrindRunner::error, this, &MemcheckToolRunner::parserError);
|
||||||
this, &MemcheckToolRunner::parserError);
|
|
||||||
|
|
||||||
if (m_withGdb) {
|
if (m_withGdb) {
|
||||||
connect(&m_runner, &ValgrindRunner::valgrindStarted,
|
connect(&m_runner, &ValgrindRunner::valgrindStarted,
|
||||||
@@ -1164,7 +1163,7 @@ MemcheckToolRunner::MemcheckToolRunner(RunControl *runControl)
|
|||||||
this, &MemcheckToolRunner::appendLog);
|
this, &MemcheckToolRunner::appendLog);
|
||||||
// m_runner.disableXml();
|
// m_runner.disableXml();
|
||||||
} else {
|
} else {
|
||||||
connect(m_runner.parser(), &XmlProtocol::ThreadedParser::internalError,
|
connect(&m_runner, &ValgrindRunner::internalError,
|
||||||
this, &MemcheckToolRunner::internalParserError);
|
this, &MemcheckToolRunner::internalParserError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include "xmlprotocol/error.h"
|
#include "xmlprotocol/error.h"
|
||||||
#include "xmlprotocol/status.h"
|
#include "xmlprotocol/status.h"
|
||||||
#include "xmlprotocol/threadedparser.h"
|
|
||||||
#include "xmlprotocol/parser.h"
|
#include "xmlprotocol/parser.h"
|
||||||
#include "valgrindrunner.h"
|
#include "valgrindrunner.h"
|
||||||
|
|
||||||
@@ -66,12 +65,9 @@ class RunnerDumper : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit RunnerDumper(ValgrindRunner *runner)
|
explicit RunnerDumper(ValgrindRunner *runner)
|
||||||
{
|
{
|
||||||
connect(runner->parser(), &XmlProtocol::ThreadedParser::error,
|
connect(runner, &ValgrindRunner::error, this, &RunnerDumper::error);
|
||||||
this, &RunnerDumper::error);
|
connect(runner, &ValgrindRunner::internalError, this, &RunnerDumper::internalError);
|
||||||
connect(runner->parser(), &XmlProtocol::ThreadedParser::internalError,
|
connect(runner, &ValgrindRunner::status, this, &RunnerDumper::status);
|
||||||
this, &RunnerDumper::internalError);
|
|
||||||
connect(runner->parser(), &XmlProtocol::ThreadedParser::status,
|
|
||||||
this, &RunnerDumper::status);
|
|
||||||
connect(runner, &ValgrindRunner::logMessageReceived,
|
connect(runner, &ValgrindRunner::logMessageReceived,
|
||||||
this, &RunnerDumper::logMessageReceived);
|
this, &RunnerDumper::logMessageReceived);
|
||||||
connect(runner, &ValgrindRunner::processErrorReceived,
|
connect(runner, &ValgrindRunner::processErrorReceived,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
using namespace Valgrind::XmlProtocol;
|
||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ public:
|
|||||||
QHostAddress m_localServerAddress;
|
QHostAddress m_localServerAddress;
|
||||||
|
|
||||||
QTcpServer m_xmlServer;
|
QTcpServer m_xmlServer;
|
||||||
XmlProtocol::ThreadedParser m_parser;
|
ThreadedParser m_parser;
|
||||||
QTcpServer m_logServer;
|
QTcpServer m_logServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -159,6 +160,9 @@ bool ValgrindRunner::Private::run()
|
|||||||
ValgrindRunner::ValgrindRunner(QObject *parent)
|
ValgrindRunner::ValgrindRunner(QObject *parent)
|
||||||
: QObject(parent), d(new Private(this))
|
: QObject(parent), d(new Private(this))
|
||||||
{
|
{
|
||||||
|
connect(&d->m_parser, &ThreadedParser::status, this, &ValgrindRunner::status);
|
||||||
|
connect(&d->m_parser, &ThreadedParser::error, this, &ValgrindRunner::error);
|
||||||
|
connect(&d->m_parser, &ThreadedParser::internalError, this, &ValgrindRunner::internalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
ValgrindRunner::~ValgrindRunner()
|
ValgrindRunner::~ValgrindRunner()
|
||||||
@@ -225,9 +229,4 @@ void ValgrindRunner::stop()
|
|||||||
d->m_process.stop();
|
d->m_process.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlProtocol::ThreadedParser *ValgrindRunner::parser() const
|
|
||||||
{
|
|
||||||
return &d->m_parser;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Valgrind
|
} // namespace Valgrind
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ namespace ProjectExplorer { class Runnable; }
|
|||||||
|
|
||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
|
|
||||||
namespace XmlProtocol { class ThreadedParser; }
|
namespace XmlProtocol {
|
||||||
|
class Error;
|
||||||
|
class Status;
|
||||||
|
}
|
||||||
|
|
||||||
class ValgrindRunner : public QObject
|
class ValgrindRunner : public QObject
|
||||||
{
|
{
|
||||||
@@ -39,8 +42,6 @@ public:
|
|||||||
bool start();
|
bool start();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
XmlProtocol::ThreadedParser *parser() const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void appendMessage(const QString &, Utils::OutputFormat);
|
void appendMessage(const QString &, Utils::OutputFormat);
|
||||||
|
|
||||||
@@ -50,6 +51,11 @@ signals:
|
|||||||
void valgrindStarted(qint64 pid);
|
void valgrindStarted(qint64 pid);
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
|
// Parser's signals
|
||||||
|
void status(const Valgrind::XmlProtocol::Status &status);
|
||||||
|
void error(const Valgrind::XmlProtocol::Error &error);
|
||||||
|
void internalError(const QString &errorString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
Private *d;
|
Private *d;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "xmlprotocol/frame.h"
|
#include "xmlprotocol/frame.h"
|
||||||
#include "xmlprotocol/stack.h"
|
#include "xmlprotocol/stack.h"
|
||||||
#include "xmlprotocol/threadedparser.h"
|
|
||||||
#include "valgrindrunner.h"
|
#include "valgrindrunner.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
@@ -117,10 +116,8 @@ void ValgrindTestRunnerTest::init()
|
|||||||
this, &ValgrindTestRunnerTest::logMessageReceived);
|
this, &ValgrindTestRunnerTest::logMessageReceived);
|
||||||
connect(m_runner, &ValgrindRunner::processErrorReceived,
|
connect(m_runner, &ValgrindRunner::processErrorReceived,
|
||||||
this, &ValgrindTestRunnerTest::internalError);
|
this, &ValgrindTestRunnerTest::internalError);
|
||||||
connect(m_runner->parser(), &ThreadedParser::internalError,
|
connect(m_runner, &ValgrindRunner::internalError, this, &ValgrindTestRunnerTest::internalError);
|
||||||
this, &ValgrindTestRunnerTest::internalError);
|
connect(m_runner, &ValgrindRunner::error, this, &ValgrindTestRunnerTest::error);
|
||||||
connect(m_runner->parser(), &ThreadedParser::error,
|
|
||||||
this, &ValgrindTestRunnerTest::error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//BEGIN: Actual test cases
|
//BEGIN: Actual test cases
|
||||||
|
|||||||
@@ -34,11 +34,9 @@ int main(int argc, char *argv[])
|
|||||||
runner.setValgrindCommand({VALGRIND_FAKE_PATH,
|
runner.setValgrindCommand({VALGRIND_FAKE_PATH,
|
||||||
{"-i", PARSERTESTS_DATA_DIR "/memcheck-output-sample1.xml"}});
|
{"-i", PARSERTESTS_DATA_DIR "/memcheck-output-sample1.xml"}});
|
||||||
ModelDemo demo(&runner);
|
ModelDemo demo(&runner);
|
||||||
QObject::connect(&runner, &ValgrindRunner::finished,
|
QObject::connect(&runner, &ValgrindRunner::finished, &demo, &ModelDemo::finished);
|
||||||
&demo, &ModelDemo::finished);
|
|
||||||
ErrorListModel model;
|
ErrorListModel model;
|
||||||
QObject::connect(runner.parser(), &ThreadedParser::error,
|
QObject::connect(&runner, &ValgrindRunner::error, &model, &ErrorListModel::addError,
|
||||||
&model, &ErrorListModel::addError,
|
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
QTreeView errorview;
|
QTreeView errorview;
|
||||||
|
|||||||
Reference in New Issue
Block a user