diff options
author | Katja Marttila <katja.marttila@qt.io> | 2022-05-10 07:29:03 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2022-05-13 14:32:31 +0300 |
commit | 82c175d76f1c40868b47f18d95376dce34e0416e (patch) | |
tree | 1d7c541f12f5193b381f62556854864c9c513c4e /tests | |
parent | e0371c9d74a3a9c971f5cae807176226158cfdde (diff) |
Fix updating autodependency components
Autodependency components were always forcely updated, even if 'Deselect
All' was selected in component selection page. Fixed so that the
autodependency component update is updated only when one of its
dependants is updated.
Task-number: QTIFW-2595
Change-Id: I05ececc45ef32ff80d53b008f839b358158a3316
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp | 45 | ||||
-rw-r--r-- | tests/auto/installer/solver/tst_solver.cpp | 5 |
2 files changed, 45 insertions, 5 deletions
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp index 2aebb1c06..04b11d427 100644 --- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp +++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp @@ -216,12 +216,11 @@ private slots: componentResourcesAfterUpdate.clear(); componentResourcesAfterUpdate.append(ComponentResource("componentA", "1.0.0content.txt")); componentResourcesAfterUpdate.append(ComponentResource("componentB", "1.0.0content.txt")); - componentResourcesAfterUpdate.append(ComponentResource("componentD", "2.0.0content.txt")); + componentResourcesAfterUpdate.append(ComponentResource("componentD", "1.0.0content.txt"));//AutodepenOn componentA,componentB componentResourcesAfterUpdate.append(ComponentResource("componentE", "2.0.0content.txt")); componentResourcesAfterUpdate.append(ComponentResource("componentG", "2.0.0content.txt")); deletedComponentResources.clear(); - deletedComponentResources.append(ComponentResource("componentD", "1.0.0content.txt")); deletedComponentResources.append(ComponentResource("componentE", "1.0.0content.txt")); deletedComponentResources.append(ComponentResource("componentG", "1.0.0content.txt")); @@ -240,7 +239,7 @@ private slots: << PackageManagerCore::Success << componentResourcesAfterUpdate << (QStringList() << "components.xml" << "installcontent.txt" << "installcontentA.txt" - << "installcontentD_update.txt" << "installcontentB.txt" + << "installcontentD.txt" << "installcontentB.txt" << "installcontentE_update.txt" << "installcontentG_update.txt") << deletedComponentResources; @@ -310,6 +309,46 @@ private slots: << "installcontentF_1_2.txt" << "installcontentF_2_update.txt" << "installcontentF_2_1.txt" << "installcontentF_2_2.txt" << "installcontentG_update.txt" << "installcontentH.txt") << deletedComponentResources; + + /*********** Update packages with AutoDependOn **********/ + componentResources.clear(); + componentResources.append(ComponentResource("componentA", "1.0.0content.txt")); + componentResources.append(ComponentResource("componentB", "1.0.0content.txt")); + componentResources.append(ComponentResource("componentD", "1.0.0content.txt")); + componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); + componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); + + installDir = QInstaller::generateTemporaryFileName(); + core = PackageManager::getPackageManagerWithInit(installDir); + componentResourcesAfterUpdate.clear(); + componentResourcesAfterUpdate.append(ComponentResource("componentA", "1.0.0content.txt")); + componentResourcesAfterUpdate.append(ComponentResource("componentB", "2.0.0content.txt")); + componentResourcesAfterUpdate.append(ComponentResource("componentD", "2.0.0content.txt"));//AutodepenOn componentA,componentB + componentResourcesAfterUpdate.append(ComponentResource("componentE", "2.0.0content.txt"));//ForcedInstall + componentResourcesAfterUpdate.append(ComponentResource("componentG", "1.0.0content.txt")); + + deletedComponentResources.clear(); + deletedComponentResources.append(ComponentResource("componentB", "1.0.0content.txt")); + deletedComponentResources.append(ComponentResource("componentD", "1.0.0content.txt")); + + QTest::newRow("Update packages with AutoDependOn") + << installDir + << core + << ":///data/installPackagesRepository" + << (QStringList()<< "componentA" << "componentB" << "componentE" << "componentG") + << PackageManagerCore::Success + << componentResources + << (QStringList() << "components.xml" << "installcontent.txt" << "installcontentA.txt" + << "installcontentD.txt" << "installcontentB.txt" << "installcontentE.txt" + << "installcontentG.txt") + << ":///data/installPackagesRepositoryUpdate" + << (QStringList() << "componentB") + << PackageManagerCore::Success + << componentResourcesAfterUpdate + << (QStringList() << "components.xml" << "installcontent.txt" << "installcontentA.txt" + << "installcontentD_update.txt" << "installcontentB_update.txt" + << "installcontentE_update.txt" << "installcontentG.txt") + << deletedComponentResources; } void testUpdate() diff --git a/tests/auto/installer/solver/tst_solver.cpp b/tests/auto/installer/solver/tst_solver.cpp index f4e10f5e7..45fadc4e6 100644 --- a/tests/auto/installer/solver/tst_solver.cpp +++ b/tests/auto/installer/solver/tst_solver.cpp @@ -192,7 +192,8 @@ private slots: QFETCH(QList<int>, installReason); QFETCH(AutoDependencyHash, autodependencyHash); - InstallerCalculator calc(core->components(PackageManagerCore::ComponentType::AllNoReplacements), autodependencyHash); + InstallerCalculator calc(core, core->components(PackageManagerCore::ComponentType::AllNoReplacements) + , autodependencyHash); calc.appendComponentsToInstall(selectedComponents); QList<Component *> result = calc.orderedComponentsToInstall(); @@ -235,7 +236,7 @@ private slots: QFETCH(QList<Component *> , selectedComponents); QFETCH(QList<Component *> , expectedResult); - InstallerCalculator calc(core->components(PackageManagerCore::ComponentType::AllNoReplacements), QHash<QString, QStringList>()); + InstallerCalculator calc(core, core->components(PackageManagerCore::ComponentType::AllNoReplacements), QHash<QString, QStringList>()); QTest::ignoreMessage(QtWarningMsg, "Cannot find missing dependency \"B->=2.0.0\" for \"A\"."); calc.appendComponentsToInstall(selectedComponents); |