ValgrindMemcheckParserTest: Fix const correctness

Simplify list c'tors.

Change-Id: Ib2534acfda1e0b24d8cfd10c7f48b585c881929a
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:
Jarek Kobus
2023-08-05 14:02:34 +02:00
parent fbf9325395
commit 94f4c21740

View File

@@ -131,12 +131,12 @@ static QString extraDataFile(const QString &file)
// Clone test data from: https://git.qt.io/chstenge/creator-test-data
static QString prefix = qtcEnvironmentVariable("QTC_TEST_EXTRADATALOCATION");
if (prefix.isEmpty())
return QString();
return {};
QFileInfo fi(QString(prefix + "/valgrind"), file);
const QFileInfo fi(QString(prefix + "/valgrind"), file);
if (fi.exists())
return fi.canonicalFilePath();
return QString();
return {};
}
void ValgrindMemcheckParserTest::initTestCase()
@@ -152,7 +152,7 @@ void ValgrindMemcheckParserTest::initTest(const QString &testfile, const QString
m_process = new QProcess(m_server);
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
const QString fakeValgrind = fakeValgrindExecutable();
QFileInfo fileInfo(fakeValgrind);
const QFileInfo fileInfo(fakeValgrind);
QVERIFY2(fileInfo.isExecutable(), qPrintable(fakeValgrind));
QVERIFY2(!fileInfo.isDir(), qPrintable(fakeValgrind));
@@ -212,7 +212,7 @@ void ValgrindMemcheckParserTest::testHelgrindSample1()
frame12.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread");
frame12.setFileName("qmutex.h");
frame12.setLine(120);
stack1.setFrames(QList<Frame>() << frame11 << frame12);
stack1.setFrames({frame11, frame12});
Stack stack2;
stack2.setAuxWhat("Required order was established by acquisition of lock at 0xA39C270");
@@ -230,7 +230,7 @@ void ValgrindMemcheckParserTest::testHelgrindSample1()
frame22.setDirectory("/home/frank/source/tarballs/qt-4.6.3-build/src/corelib/../../include/QtCore/../../src/corelib/thread");
frame22.setFileName("qmutex.h");
frame22.setLine(121);
stack2.setFrames(QList<Frame>() << frame21 << frame22);
stack2.setFrames({frame21, frame22});
Stack stack3;
stack3.setAuxWhat("followed by a later acquisition of lock at 0xA3AC010");
@@ -249,8 +249,8 @@ void ValgrindMemcheckParserTest::testHelgrindSample1()
frame32.setFileName("qmutex.h");
frame32.setLine(122);
stack3.setFrames(QList<Frame>() << frame31 << frame32);
error1.setStacks(QList<Stack>() << stack1 << stack2 << stack3);
stack3.setFrames({frame31, frame32});
error1.setStacks({stack1, stack2, stack3});
expectedErrors.append(error1);
}
@@ -316,8 +316,8 @@ void ValgrindMemcheckParserTest::testMemcheckSample1()
f4.setLine(4396);
Stack s1;
s1.setAuxWhat("Address 0x11527cb8 is not stack'd, malloc'd or (recently) free'd");
s1.setFrames(QList<Frame>() << f1 << f2 << f3 << f4);
error.setStacks(QList<Stack>() << s1);
s1.setFrames({f1, f2, f3, f4});
error.setStacks({s1});
expectedErrors << error;
}
@@ -503,10 +503,11 @@ void ValgrindMemcheckParserTest::testParserStop()
void ValgrindMemcheckParserTest::testRealValgrind()
{
const Environment &sysEnv = Environment::systemEnvironment();
auto fileName = sysEnv.searchInPath("valgrind");
const auto fileName = sysEnv.searchInPath("valgrind");
if (fileName.isEmpty())
QSKIP("This test needs valgrind in PATH");
QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN", fakeValgrindExecutable());
QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN",
fakeValgrindExecutable());
qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this";
ProjectExplorer::Runnable debuggee;