diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-09-28 14:28:33 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-10-09 09:04:48 +0300 |
commit | 9f94110b7de18870d690d8ad102d26deceb17e0e (patch) | |
tree | cc37f72d935c6fa500927b8c1764c46fe01ea61f /tests | |
parent | 2ee0e4847d0a6fe9b2fe14dca41f3b1e6123a85e (diff) |
Fix essential update
When updating essential, no other components should be installed nor
updated unless there is autodepend on the essential component.
Task-number: QTIFW-1970
Change-Id: If9edd6515e3e5ec51611ac07ac52b13f05983b9d
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests')
5 files changed, 55 insertions, 9 deletions
diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml new file mode 100644 index 000000000..1729f5732 --- /dev/null +++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/Updates.xml @@ -0,0 +1,26 @@ +<Updates> + <ApplicationName>{AnyApplication}</ApplicationName> + <ApplicationVersion>1.0.0</ApplicationVersion> + <Checksum>false</Checksum> + <PackageUpdate> + <Name>componentA</Name> + <DisplayName>Component A</DisplayName> + <Description>This component does not depend on any other component.</Description> + <Version>3.0.0</Version> + <ReleaseDate>2015-08-25</ReleaseDate> + <SortingPriority>100</SortingPriority> + <Essential>true</Essential> + <UpdateFile UncompressedSize="99" OS="Any" CompressedSize="297"/> + <DownloadableArchives>content.7z</DownloadableArchives> + </PackageUpdate> + <PackageUpdate> + <Name>componentAutoDependOnA</Name> + <DisplayName>Component, autodepends on A</DisplayName> + <Description>Component, autodepends on A</Description> + <Version>1.0</Version> + <ReleaseDate>2018-03-14</ReleaseDate> + <AutoDependOn>componentA</AutoDependOn> + <UpdateFile UncompressedSize="99" OS="Any" CompressedSize="305"/> + <DownloadableArchives>content.7z</DownloadableArchives> + </PackageUpdate> +</Updates> diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z Binary files differnew file mode 100644 index 000000000..e8c35fdea --- /dev/null +++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z diff --git a/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z Binary files differnew file mode 100644 index 000000000..0f3b123e0 --- /dev/null +++ b/tests/auto/installer/commandlineupdate/data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z diff --git a/tests/auto/installer/commandlineupdate/settings.qrc b/tests/auto/installer/commandlineupdate/settings.qrc index 812727cd2..a0a04a9e3 100644 --- a/tests/auto/installer/commandlineupdate/settings.qrc +++ b/tests/auto/installer/commandlineupdate/settings.qrc @@ -31,5 +31,8 @@ <file>data/installPackagesRepositoryUpdate/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z</file> <file>data/installPackagesRepositoryUpdate/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z</file> <file>data/installPackagesRepositoryUpdate/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z</file> + <file>data/repositoryWithDependencyToEssential/Updates.xml</file> + <file>data/repositoryWithDependencyToEssential/componentAutoDependOnA/1.0content.7z</file> + <file>data/repositoryWithDependencyToEssential/componentA/3.0.0content.7z</file> </qresource> </RCC> diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp index 7a61e9608..e465f8a75 100644 --- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp +++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp @@ -86,28 +86,43 @@ private slots: QCOMPARE(PackageManagerCore::EssentialUpdated, core->updateComponentsSilently(QStringList())); VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt"); VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); - //Because of bug QTIFW-1970 componentD got installed too VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" - << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt" - << "installcontentD_update.txt"); + << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"); VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentA", "1.0.0content.txt"); //As we are using the same core in tests, clean the essentalupdate value core->setFoundEssentialUpdate(false); } + void testUpdateEssentialWithAutodependOnSilently() + { + setRepository(":///data/repositoryWithDependencyToEssential"); + QCOMPARE(PackageManagerCore::EssentialUpdated, core->updateComponentsSilently(QStringList())); + + VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt"); + VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt"); + VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" + << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt" + << "installContentAutoDependOnA.txt"); + + //As we are using the same core in tests, clean the essentalupdate value + core->setFoundEssentialUpdate(false); + } + void testUpdatePackageSilently() { setRepository(":///data/installPackagesRepository"); QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList() << "componentB")); QCOMPARE(PackageManagerCore::Success, core->status()); - //Because of bug QTIFW-1970 componentD got uninstalled. It should be installed now - //as its dependencies are installed. - VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt"); + + VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt"); VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt"); + VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt"); + VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt"); VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt" - << "installcontentB.txt"); + << "installcontentB.txt" << "installcontentD.txt" + << "installContentAutoDependOnA.txt"); core->commitSessionOperations(); setRepository(":///data/installPackagesRepositoryUpdate"); @@ -115,16 +130,18 @@ private slots: << "componentB")); // componentD is autodependent and cannot be deselected // componentE is a forced component and thus will be updated - VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "2.0.0content.txt"); + VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "3.0.0content.txt"); VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "2.0.0content.txt"); VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "2.0.0content.txt"); VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "2.0.0content.txt"); + VerifyInstaller::verifyInstallerResources(m_installDir, "componentAutoDependOnA", "1.0content.txt"); VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentD", "1.0.0content.txt"); VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentE", "1.0.0content.txt"); VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentA_update.txt" << "installcontentE_update.txt" << "installcontentG.txt" - << "installcontentB_update.txt" << "installcontentD_update.txt"); + << "installcontentB_update.txt" << "installcontentD_update.txt" + << "installContentAutoDependOnA.txt"); } void testUpdateNoUpdatesForSelectedPackage() |