forked from qt-creator/qt-creator
McuSupport: Test package fallback/default path
Change-Id: I26107fc28fd4d82a550953a38649a19e43563b47 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -602,6 +602,49 @@ void McuSupportTest::test_twoDotOneUsesLegacyImplementation()
|
|||||||
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 0}), false);
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 0}), false);
|
||||||
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 1}), false);
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 1}), false);
|
||||||
}
|
}
|
||||||
|
void McuSupportTest::test_useFallbackPathForToolchainWhenPathFromSettingsIsNotAvailable()
|
||||||
|
{
|
||||||
|
Sdk::PackageDescription compilerDescription{armGcc,
|
||||||
|
armGccEnvVar,
|
||||||
|
Constants::TOOLCHAIN_DIR_CMAKE_VARIABLE,
|
||||||
|
armGcc,
|
||||||
|
armGccDirectorySetting,
|
||||||
|
fallbackDir,
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
false};
|
||||||
|
Sdk::McuTargetDescription::Toolchain toolchainDescription{armGcc, {}, compilerDescription, {}};
|
||||||
|
|
||||||
|
EXPECT_CALL(*settingsMockPtr, getPath(QString{armGccDirectorySetting}, _, FilePath{fallbackDir}))
|
||||||
|
.Times(2)
|
||||||
|
.WillRepeatedly(Return(FilePath{fallbackDir}));
|
||||||
|
|
||||||
|
McuToolChainPackage *toolchain = targetFactory.createToolchain(toolchainDescription);
|
||||||
|
|
||||||
|
QCOMPARE(toolchain->path().toString(), fallbackDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
void McuSupportTest::test_usePathFromSettingsForToolchainPath()
|
||||||
|
{
|
||||||
|
Sdk::PackageDescription compilerDescription{{},
|
||||||
|
armGccEnvVar,
|
||||||
|
Constants::TOOLCHAIN_DIR_CMAKE_VARIABLE,
|
||||||
|
armGcc,
|
||||||
|
armGccDirectorySetting,
|
||||||
|
empty,
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
false};
|
||||||
|
Sdk::McuTargetDescription::Toolchain toolchainDescription{armGcc, {}, compilerDescription, {}};
|
||||||
|
|
||||||
|
EXPECT_CALL(*settingsMockPtr, getPath(QString{armGccDirectorySetting}, _, FilePath{empty}))
|
||||||
|
.Times(2)
|
||||||
|
.WillOnce(Return(FilePath{empty})) // system scope settings
|
||||||
|
.WillOnce(Return(FilePath{armGccDir})); // user scope settings
|
||||||
|
|
||||||
|
McuToolChainPackage *toolchain = targetFactory.createToolchain(toolchainDescription);
|
||||||
|
QCOMPARE(toolchain->path().toString(), armGccDir);
|
||||||
|
}
|
||||||
|
|
||||||
void McuSupportTest::test_addNewKit()
|
void McuSupportTest::test_addNewKit()
|
||||||
{
|
{
|
||||||
|
@@ -78,6 +78,8 @@ private slots:
|
|||||||
void test_createArmGccToolchain();
|
void test_createArmGccToolchain();
|
||||||
void test_removeRtosSuffixFromEnvironmentVariable_data();
|
void test_removeRtosSuffixFromEnvironmentVariable_data();
|
||||||
void test_removeRtosSuffixFromEnvironmentVariable();
|
void test_removeRtosSuffixFromEnvironmentVariable();
|
||||||
|
void test_useFallbackPathForToolchainWhenPathFromSettingsIsNotAvailable();
|
||||||
|
void test_usePathFromSettingsForToolchainPath();
|
||||||
|
|
||||||
void test_twoDotOneUsesLegacyImplementation();
|
void test_twoDotOneUsesLegacyImplementation();
|
||||||
void test_addToolchainFileInfoToKit();
|
void test_addToolchainFileInfoToKit();
|
||||||
|
Reference in New Issue
Block a user