AutoTest: Fix some clazy warnings

Avoids potential nullptr accesses and unneeded allocations.

Change-Id: I8c13ca1dab885fc3e9a05dc7329ff592a7f0fe1a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2021-01-19 07:50:29 +01:00
parent 0fa391c7d3
commit da07d8f5c3
3 changed files with 5 additions and 3 deletions

View File

@@ -80,7 +80,7 @@ void AutoTestUnitTests::initTestCase()
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(":/unit_test"); m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(":/unit_test");
if (!qgetenv("BOOST_INCLUDE_DIR").isEmpty()) { if (!qEnvironmentVariableIsEmpty("BOOST_INCLUDE_DIR")) {
m_checkBoost = true; m_checkBoost = true;
} else { } else {
if (Utils::HostOsInfo::isLinuxHost() if (Utils::HostOsInfo::isLinuxHost()
@@ -200,7 +200,7 @@ void AutoTestUnitTests::testCodeParserSwitchStartup_data()
void AutoTestUnitTests::testCodeParserGTest() void AutoTestUnitTests::testCodeParserGTest()
{ {
if (qgetenv("GOOGLETEST_DIR").isEmpty()) if (qEnvironmentVariableIsEmpty("GOOGLETEST_DIR"))
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)"); QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
QFETCH(QString, projectFilePath); QFETCH(QString, projectFilePath);

View File

@@ -74,7 +74,8 @@ static QStringList filterInterfering(const QStringList &provided, QStringList *o
for (const auto &arg : provided) { for (const auto &arg : provided) {
bool interferes = false; bool interferes = false;
if (filterNext) { if (filterNext) {
omitted->append(arg); if (omitted)
omitted->append(arg);
filterNext = false; filterNext = false;
continue; continue;
} }

View File

@@ -254,6 +254,7 @@ void TestTreeModel::onBuildSystemTestsUpdated()
if (!bs || !bs->project()) if (!bs || !bs->project())
return; return;
QTC_ASSERT(m_checkStateCache, return);
m_checkStateCache->evolve(ITestBase::Tool); m_checkStateCache->evolve(ITestBase::Tool);
ITestTool *testTool = TestFrameworkManager::testToolForBuildSystemId(bs->project()->id()); ITestTool *testTool = TestFrameworkManager::testToolForBuildSystemId(bs->project()->id());