Utils: Add CommandLine convenience constructors

... taking a QString for the executable.

This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.

I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.

Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-23 10:17:57 +02:00
parent 80716610c5
commit 8b72e92167
31 changed files with 55 additions and 53 deletions

View File

@@ -81,7 +81,7 @@ void ValgrindToolRunner::start()
emit outputReceived(tr("Command line arguments: %1").arg(runnable().debuggeeArgs), DebugFormat);
#endif
CommandLine valgrind{FilePath::fromString(m_settings->valgrindExecutable())};
CommandLine valgrind{m_settings->valgrindExecutable()};
valgrind.addArgs(genericToolArguments());
valgrind.addArgs(toolArguments());

View File

@@ -477,7 +477,7 @@ void ValgrindMemcheckParserTest::testValgrindGarbage()
void ValgrindMemcheckParserTest::testParserStop()
{
ValgrindRunner runner;
runner.setValgrindCommand({FilePath::fromString(fakeValgrindExecutable()),
runner.setValgrindCommand({fakeValgrindExecutable(),
{QString("--xml-socket=127.0.0.1:%1").arg(m_server->serverPort()),
"-i", dataFile("memcheck-output-sample1.xml"), "--wait", "5" }});
runner.setProcessChannelMode(QProcess::ForwardedChannels);
@@ -502,7 +502,7 @@ void ValgrindMemcheckParserTest::testRealValgrind()
debuggee.executable = FilePath::fromString(executable);
debuggee.environment = sysEnv;
ValgrindRunner runner;
runner.setValgrindCommand({FilePath::fromString("valgrind"), {}});
runner.setValgrindCommand({"valgrind", {}});
runner.setDebuggee(debuggee);
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));
@@ -541,7 +541,7 @@ void ValgrindMemcheckParserTest::testValgrindStartError()
debuggeeExecutable.commandLineArguments = debuggeeArgs;
ValgrindRunner runner;
runner.setValgrindCommand({FilePath::fromString(valgrindExe), valgrindArgs});
runner.setValgrindCommand({valgrindExe, valgrindArgs});
runner.setDebuggee(debuggeeExecutable);
runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice(
ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE));

View File

@@ -85,8 +85,7 @@ QString ValgrindTestRunnerTest::runTestBinary(const QString &binary, const QStri
debuggee.executable = Utils::FilePath::fromString(binPath);
debuggee.environment = Utils::Environment::systemEnvironment();
CommandLine valgrind{FilePath::fromString("valgrind")};
valgrind.addArgs({"--num-callers=50", "--track-origins=yes"});
CommandLine valgrind{"valgrind", {"--num-callers=50", "--track-origins=yes"}};
valgrind.addArgs(vArgs);
m_runner->setLocalServerAddress(QHostAddress::LocalHost);