Valgrind: Rename ValgrindRunner -> ValgrindProcess

Change-Id: I5e7d704c749e53672915c5f7aab64abb68353f24
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-08-16 23:17:10 +02:00
parent e8510501d8
commit 1d5102781d
11 changed files with 58 additions and 58 deletions

View File

@@ -32,10 +32,10 @@ CallgrindToolRunner::CallgrindToolRunner(RunControl *runControl)
{ {
setId("CallgrindToolRunner"); setId("CallgrindToolRunner");
connect(&m_runner, &ValgrindRunner::valgrindStarted, this, [this](qint64 pid) { connect(&m_runner, &ValgrindProcess::valgrindStarted, this, [this](qint64 pid) {
m_pid = pid; m_pid = pid;
}); });
connect(&m_runner, &ValgrindRunner::done, this, [this] { connect(&m_runner, &ValgrindProcess::done, this, [this] {
triggerParse(); triggerParse();
emit parserDataReady(this); emit parserDataReady(this);
}); });

View File

@@ -169,7 +169,7 @@ void MemcheckToolRunner::start()
void MemcheckToolRunner::stop() void MemcheckToolRunner::stop()
{ {
disconnect(&m_runner, &ValgrindRunner::internalError, disconnect(&m_runner, &ValgrindProcess::internalError,
this, &MemcheckToolRunner::internalParserError); this, &MemcheckToolRunner::internalParserError);
ValgrindToolRunner::stop(); ValgrindToolRunner::stop();
} }
@@ -1148,15 +1148,15 @@ MemcheckToolRunner::MemcheckToolRunner(RunControl *runControl)
m_localServerAddress(QHostAddress::LocalHost) m_localServerAddress(QHostAddress::LocalHost)
{ {
setId("MemcheckToolRunner"); setId("MemcheckToolRunner");
connect(&m_runner, &ValgrindRunner::error, this, &MemcheckToolRunner::parserError); connect(&m_runner, &ValgrindProcess::error, this, &MemcheckToolRunner::parserError);
if (m_withGdb) { if (m_withGdb) {
connect(&m_runner, &ValgrindRunner::valgrindStarted, connect(&m_runner, &ValgrindProcess::valgrindStarted,
this, &MemcheckToolRunner::startDebugger); this, &MemcheckToolRunner::startDebugger);
connect(&m_runner, &ValgrindRunner::logMessageReceived, connect(&m_runner, &ValgrindProcess::logMessageReceived,
this, &MemcheckToolRunner::appendLog); this, &MemcheckToolRunner::appendLog);
} else { } else {
connect(&m_runner, &ValgrindRunner::internalError, connect(&m_runner, &ValgrindProcess::internalError,
this, &MemcheckToolRunner::internalParserError); this, &MemcheckToolRunner::internalParserError);
} }

View File

@@ -33,11 +33,11 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS)); m_settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS));
connect(&m_runner, &ValgrindRunner::appendMessage, this, connect(&m_runner, &ValgrindProcess::appendMessage, this,
[this](const QString &msg, Utils::OutputFormat format) { appendMessage(msg, format); }); [this](const QString &msg, Utils::OutputFormat format) { appendMessage(msg, format); });
connect(&m_runner, &ValgrindRunner::processErrorReceived, connect(&m_runner, &ValgrindProcess::processErrorReceived,
this, &ValgrindToolRunner::receiveProcessError); this, &ValgrindToolRunner::receiveProcessError);
connect(&m_runner, &ValgrindRunner::done, connect(&m_runner, &ValgrindProcess::done,
this, &ValgrindToolRunner::runnerFinished); this, &ValgrindToolRunner::runnerFinished);
} }

View File

@@ -26,7 +26,7 @@ protected:
ValgrindSettings m_settings{false}; ValgrindSettings m_settings{false};
QFutureInterface<void> m_progress; QFutureInterface<void> m_progress;
ValgrindRunner m_runner; ValgrindProcess m_runner;
private: private:
void handleProgressCanceled(); void handleProgressCanceled();

View File

@@ -77,22 +77,22 @@ public:
class RunnerDumper : public QObject class RunnerDumper : public QObject
{ {
public: public:
explicit RunnerDumper(ValgrindRunner *runner) explicit RunnerDumper(ValgrindProcess *runner)
{ {
connect(runner, &ValgrindRunner::error, this, [](const Error &err) { connect(runner, &ValgrindProcess::error, this, [](const Error &err) {
qDebug() << "error received"; qDebug() << "error received";
dumpError(err); dumpError(err);
}); });
connect(runner, &ValgrindRunner::internalError, this, [](const QString &err) { connect(runner, &ValgrindProcess::internalError, this, [](const QString &err) {
qDebug() << "internal error received:" << err; qDebug() << "internal error received:" << err;
}); });
connect(runner, &ValgrindRunner::status, this, [](const Status &status) { connect(runner, &ValgrindProcess::status, this, [](const Status &status) {
qDebug() << "status received:" << status.state() << status.time(); qDebug() << "status received:" << status.state() << status.time();
}); });
connect(runner, &ValgrindRunner::logMessageReceived, this, [](const QByteArray &log) { connect(runner, &ValgrindProcess::logMessageReceived, this, [](const QByteArray &log) {
qDebug() << "log message received:" << log; qDebug() << "log message received:" << log;
}); });
connect(runner, &ValgrindRunner::processErrorReceived, this, [this](const QString &) { connect(runner, &ValgrindProcess::processErrorReceived, this, [this](const QString &) {
m_errorReceived = true; m_errorReceived = true;
}); });
} }
@@ -486,7 +486,7 @@ void ValgrindMemcheckParserTest::testValgrindGarbage()
void ValgrindMemcheckParserTest::testParserStop() void ValgrindMemcheckParserTest::testParserStop()
{ {
ValgrindRunner runner; ValgrindProcess runner;
runner.setValgrindCommand({FilePath::fromString(fakeValgrindExecutable()), runner.setValgrindCommand({FilePath::fromString(fakeValgrindExecutable()),
{QString("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort()), {QString("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort()),
"-i", dataFile("memcheck-output-sample1.xml"), "--wait", "5" }}); "-i", dataFile("memcheck-output-sample1.xml"), "--wait", "5" }});
@@ -510,7 +510,7 @@ void ValgrindMemcheckParserTest::testRealValgrind()
ProcessRunData debuggee; ProcessRunData debuggee;
debuggee.command.setExecutable(FilePath::fromString(executable)); debuggee.command.setExecutable(FilePath::fromString(executable));
debuggee.environment = sysEnv; debuggee.environment = sysEnv;
ValgrindRunner runner; ValgrindProcess runner;
runner.setValgrindCommand({"valgrind", {}}); runner.setValgrindCommand({"valgrind", {}});
runner.setDebuggee(debuggee); runner.setDebuggee(debuggee);
RunnerDumper dumper(&runner); RunnerDumper dumper(&runner);
@@ -546,7 +546,7 @@ void ValgrindMemcheckParserTest::testValgrindStartError()
debuggeeExecutable.command.setArguments(debuggeeArgs); debuggeeExecutable.command.setArguments(debuggeeArgs);
debuggeeExecutable.environment = Environment::systemEnvironment(); debuggeeExecutable.environment = Environment::systemEnvironment();
ValgrindRunner runner; ValgrindProcess runner;
runner.setValgrindCommand({FilePath::fromString(valgrindExe), valgrindArgs}); runner.setValgrindCommand({FilePath::fromString(valgrindExe), valgrindArgs});
runner.setDebuggee(debuggeeExecutable); runner.setDebuggee(debuggeeExecutable);
RunnerDumper dumper(&runner); RunnerDumper dumper(&runner);

View File

@@ -57,10 +57,10 @@ static CommandLine valgrindCommand(const CommandLine &command,
return cmd; return cmd;
} }
class ValgrindRunnerPrivate : public QObject class ValgrindProcessPrivate : public QObject
{ {
public: public:
ValgrindRunnerPrivate(ValgrindRunner *owner) ValgrindProcessPrivate(ValgrindProcess *owner)
: q(owner) : q(owner)
{} {}
@@ -107,7 +107,7 @@ public:
bool run(); bool run();
ValgrindRunner *q = nullptr; ValgrindProcess *q = nullptr;
CommandLine m_valgrindCommand; CommandLine m_valgrindCommand;
ProcessRunData m_debuggee; ProcessRunData m_debuggee;
@@ -118,7 +118,7 @@ public:
std::unique_ptr<TaskTree> m_taskTree; std::unique_ptr<TaskTree> m_taskTree;
}; };
Group ValgrindRunnerPrivate::runRecipe() const Group ValgrindProcessPrivate::runRecipe() const
{ {
struct ValgrindStorage { struct ValgrindStorage {
CommandLine m_valgrindCommand; CommandLine m_valgrindCommand;
@@ -185,8 +185,8 @@ Group ValgrindRunnerPrivate::runRecipe() const
}; };
const auto onParserSetup = [this, storage](Parser &parser) { const auto onParserSetup = [this, storage](Parser &parser) {
connect(&parser, &Parser::status, q, &ValgrindRunner::status); connect(&parser, &Parser::status, q, &ValgrindProcess::status);
connect(&parser, &Parser::error, q, &ValgrindRunner::error); connect(&parser, &Parser::error, q, &ValgrindProcess::error);
parser.setSocket(storage->m_xmlSocket.release()); parser.setSocket(storage->m_xmlSocket.release());
}; };
@@ -209,7 +209,7 @@ Group ValgrindRunnerPrivate::runRecipe() const
return root; return root;
} }
bool ValgrindRunnerPrivate::run() bool ValgrindProcessPrivate::run()
{ {
m_taskTree.reset(new TaskTree); m_taskTree.reset(new TaskTree);
m_taskTree->setRecipe(runRecipe()); m_taskTree->setRecipe(runRecipe());
@@ -223,49 +223,49 @@ bool ValgrindRunnerPrivate::run()
return bool(m_taskTree); return bool(m_taskTree);
} }
ValgrindRunner::ValgrindRunner(QObject *parent) ValgrindProcess::ValgrindProcess(QObject *parent)
: QObject(parent) : QObject(parent)
, d(new ValgrindRunnerPrivate(this)) , d(new ValgrindProcessPrivate(this))
{} {}
ValgrindRunner::~ValgrindRunner() = default; ValgrindProcess::~ValgrindProcess() = default;
void ValgrindRunner::setValgrindCommand(const CommandLine &command) void ValgrindProcess::setValgrindCommand(const CommandLine &command)
{ {
d->m_valgrindCommand = command; d->m_valgrindCommand = command;
} }
void ValgrindRunner::setDebuggee(const ProcessRunData &debuggee) void ValgrindProcess::setDebuggee(const ProcessRunData &debuggee)
{ {
d->m_debuggee = debuggee; d->m_debuggee = debuggee;
} }
void ValgrindRunner::setProcessChannelMode(QProcess::ProcessChannelMode mode) void ValgrindProcess::setProcessChannelMode(QProcess::ProcessChannelMode mode)
{ {
d->m_channelMode = mode; d->m_channelMode = mode;
} }
void ValgrindRunner::setLocalServerAddress(const QHostAddress &localServerAddress) void ValgrindProcess::setLocalServerAddress(const QHostAddress &localServerAddress)
{ {
d->m_localServerAddress = localServerAddress; d->m_localServerAddress = localServerAddress;
} }
void ValgrindRunner::setUseTerminal(bool on) void ValgrindProcess::setUseTerminal(bool on)
{ {
d->m_useTerminal = on; d->m_useTerminal = on;
} }
bool ValgrindRunner::start() bool ValgrindProcess::start()
{ {
return d->run(); return d->run();
} }
void ValgrindRunner::stop() void ValgrindProcess::stop()
{ {
d->m_taskTree.reset(); d->m_taskTree.reset();
} }
bool ValgrindRunner::runBlocking() bool ValgrindProcess::runBlocking()
{ {
bool ok = false; bool ok = false;
QEventLoop loop; QEventLoop loop;
@@ -276,8 +276,8 @@ bool ValgrindRunner::runBlocking()
QMetaObject::invokeMethod(&loop, [&loop] { loop.quit(); }, Qt::QueuedConnection); QMetaObject::invokeMethod(&loop, [&loop] { loop.quit(); }, Qt::QueuedConnection);
}; };
connect(this, &ValgrindRunner::done, &loop, finalize); connect(this, &ValgrindProcess::done, &loop, finalize);
QTimer::singleShot(0, this, &ValgrindRunner::start); QTimer::singleShot(0, this, &ValgrindProcess::start);
loop.exec(QEventLoop::ExcludeUserInputEvents); loop.exec(QEventLoop::ExcludeUserInputEvents);
return ok; return ok;
} }

View File

@@ -23,15 +23,15 @@ class Error;
class Status; class Status;
} }
class ValgrindRunnerPrivate; class ValgrindProcessPrivate;
class ValgrindRunner : public QObject class ValgrindProcess : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ValgrindRunner(QObject *parent = nullptr); explicit ValgrindProcess(QObject *parent = nullptr);
~ValgrindRunner() override; ~ValgrindProcess() override;
void setValgrindCommand(const Utils::CommandLine &command); void setValgrindCommand(const Utils::CommandLine &command);
void setDebuggee(const Utils::ProcessRunData &debuggee); void setDebuggee(const Utils::ProcessRunData &debuggee);
@@ -56,7 +56,7 @@ signals:
void internalError(const QString &errorString); void internalError(const QString &errorString);
private: private:
std::unique_ptr<ValgrindRunnerPrivate> d; std::unique_ptr<ValgrindProcessPrivate> d;
}; };
} // namespace Valgrind } // namespace Valgrind

View File

@@ -103,14 +103,14 @@ void ValgrindTestRunnerTest::init()
Q_ASSERT(m_logMessages.isEmpty()); Q_ASSERT(m_logMessages.isEmpty());
Q_ASSERT(!m_runner); Q_ASSERT(!m_runner);
m_runner = new ValgrindRunner; m_runner = new ValgrindProcess;
m_runner->setProcessChannelMode(QProcess::ForwardedChannels); m_runner->setProcessChannelMode(QProcess::ForwardedChannels);
connect(m_runner, &ValgrindRunner::logMessageReceived, connect(m_runner, &ValgrindProcess::logMessageReceived,
this, &ValgrindTestRunnerTest::logMessageReceived); this, &ValgrindTestRunnerTest::logMessageReceived);
connect(m_runner, &ValgrindRunner::processErrorReceived, connect(m_runner, &ValgrindProcess::processErrorReceived,
this, &ValgrindTestRunnerTest::internalError); this, &ValgrindTestRunnerTest::internalError);
connect(m_runner, &ValgrindRunner::internalError, this, &ValgrindTestRunnerTest::internalError); connect(m_runner, &ValgrindProcess::internalError, this, &ValgrindTestRunnerTest::internalError);
connect(m_runner, &ValgrindRunner::error, this, &ValgrindTestRunnerTest::error); connect(m_runner, &ValgrindProcess::error, this, &ValgrindTestRunnerTest::error);
} }
//BEGIN: Actual test cases //BEGIN: Actual test cases

View File

@@ -10,7 +10,7 @@
namespace Valgrind { namespace Valgrind {
class ValgrindRunner; class ValgrindProcess;
namespace Test { namespace Test {
@@ -48,7 +48,7 @@ private slots:
private: private:
QString runTestBinary(const QString &binary, const QStringList &vArgs = QStringList()); QString runTestBinary(const QString &binary, const QStringList &vArgs = QStringList());
ValgrindRunner *m_runner = nullptr; ValgrindProcess *m_runner = nullptr;
QList<QByteArray> m_logMessages; QList<QByteArray> m_logMessages;
QList<XmlProtocol::Error> m_errors; QList<XmlProtocol::Error> m_errors;
bool m_expectCrash = false; bool m_expectCrash = false;

View File

@@ -29,18 +29,18 @@ int main(int argc, char *argv[])
qRegisterMetaType<Error>(); qRegisterMetaType<Error>();
ValgrindRunner runner; ValgrindProcess runner;
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::processErrorReceived, &app, [](const QString &err) { QObject::connect(&runner, &ValgrindProcess::processErrorReceived, &app, [](const QString &err) {
qDebug() << err; qDebug() << err;
}); });
QObject::connect(&runner, &ValgrindRunner::done, &app, [](bool success) { QObject::connect(&runner, &ValgrindProcess::done, &app, [](bool success) {
qApp->exit(success ? 0 : 1); qApp->exit(success ? 0 : 1);
}); });
ErrorListModel model; ErrorListModel model;
QObject::connect(&runner, &ValgrindRunner::error, &model, &ErrorListModel::addError, QObject::connect(&runner, &ValgrindProcess::error, &model, &ErrorListModel::addError,
Qt::QueuedConnection); Qt::QueuedConnection);
QTreeView errorview; QTreeView errorview;

View File

@@ -18,7 +18,7 @@ class ModelDemo : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ModelDemo(Valgrind::ValgrindRunner *r, QObject *parent = 0) explicit ModelDemo(Valgrind::ValgrindProcess *r, QObject *parent = 0)
: QObject(parent) : QObject(parent)
, runner(r) , runner(r)
{ {
@@ -37,5 +37,5 @@ public Q_SLOTS:
} }
private: private:
Valgrind::ValgrindRunner *runner; Valgrind::ValgrindProcess *runner;
}; };