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");
connect(&m_runner, &ValgrindRunner::valgrindStarted, this, [this](qint64 pid) {
connect(&m_runner, &ValgrindProcess::valgrindStarted, this, [this](qint64 pid) {
m_pid = pid;
});
connect(&m_runner, &ValgrindRunner::done, this, [this] {
connect(&m_runner, &ValgrindProcess::done, this, [this] {
triggerParse();
emit parserDataReady(this);
});

View File

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

View File

@@ -33,11 +33,11 @@ ValgrindToolRunner::ValgrindToolRunner(RunControl *runControl)
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); });
connect(&m_runner, &ValgrindRunner::processErrorReceived,
connect(&m_runner, &ValgrindProcess::processErrorReceived,
this, &ValgrindToolRunner::receiveProcessError);
connect(&m_runner, &ValgrindRunner::done,
connect(&m_runner, &ValgrindProcess::done,
this, &ValgrindToolRunner::runnerFinished);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,18 +29,18 @@ int main(int argc, char *argv[])
qRegisterMetaType<Error>();
ValgrindRunner runner;
ValgrindProcess runner;
runner.setValgrindCommand({VALGRIND_FAKE_PATH,
{"-i", PARSERTESTS_DATA_DIR "/memcheck-output-sample1.xml"}});
ModelDemo demo(&runner);
QObject::connect(&runner, &ValgrindRunner::processErrorReceived, &app, [](const QString &err) {
QObject::connect(&runner, &ValgrindProcess::processErrorReceived, &app, [](const QString &err) {
qDebug() << err;
});
QObject::connect(&runner, &ValgrindRunner::done, &app, [](bool success) {
QObject::connect(&runner, &ValgrindProcess::done, &app, [](bool success) {
qApp->exit(success ? 0 : 1);
});
ErrorListModel model;
QObject::connect(&runner, &ValgrindRunner::error, &model, &ErrorListModel::addError,
QObject::connect(&runner, &ValgrindProcess::error, &model, &ErrorListModel::addError,
Qt::QueuedConnection);
QTreeView errorview;

View File

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