summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-12-20 11:31:30 +0200
committerKatja Marttila <katja.marttila@qt.io>2020-12-22 08:38:36 +0200
commita606c9915b8ff1d6001a83aa350400d6286706ff (patch)
tree33fba20f96caf98be8d42382763d0f93f92a9366 /tests
parentb7df5571e0707f53716fa51d426d5ec31d36af43 (diff)
Introduce ForcedUpdate element for component
Setting ForcedUpdate for component will cause a mandatory update for component if it is installed. Component must be updated before any other component can be updated/installed/removed. Essential components are updated at the same time with ForcedUpdate. Task-number: QTIFW-1565 Change-Id: I6af07fba222371e8cd161d1fec65301450077d86 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml9
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepository/componentH/1.0.0content.7zbin0 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml9
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/componentH/2.0.0content.7zbin0 -> 225 bytes
-rw-r--r--tests/auto/installer/commandlineupdate/settings.qrc2
-rw-r--r--tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp28
-rw-r--r--tests/auto/installer/shared/verifyinstaller.h6
7 files changed, 50 insertions, 4 deletions
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
index 345b462d0..9e01f1800 100644
--- a/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
@@ -151,4 +151,13 @@
<DownloadableArchives>content.7z</DownloadableArchives>
<SHA1>8cba36dd589492c28e0d04942b4f8aa0a09f59cc</SHA1>
</PackageUpdate>
+ <PackageUpdate>
+ <Name>componentH</Name>
+ <DisplayName>Component H. ForcedUpdate</DisplayName>
+ <Description>Component H. ForcedUpdate</Description>
+ <Version>1.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <ForcedUpdate>true</ForcedUpdate>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ </PackageUpdate>
</Updates>
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepository/componentH/1.0.0content.7z b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/componentH/1.0.0content.7z
new file mode 100644
index 000000000..e1449ad29
--- /dev/null
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/componentH/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
index 125289261..f56888022 100644
--- a/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
@@ -151,4 +151,13 @@
<DownloadableArchives>content.7z</DownloadableArchives>
<SHA1>098b5ecafe8853371fd608acd9b1ccab252ef5df</SHA1>
</PackageUpdate>
+ <PackageUpdate>
+ <Name>componentH</Name>
+ <DisplayName>Component H. ForcedUpdate</DisplayName>
+ <Description>Component H. ForcedUpdate</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2014-08-25</ReleaseDate>
+ <ForcedUpdate>true</ForcedUpdate>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ </PackageUpdate>
</Updates>
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/componentH/2.0.0content.7z b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/componentH/2.0.0content.7z
new file mode 100644
index 000000000..f74b8da68
--- /dev/null
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/componentH/2.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/commandlineupdate/settings.qrc b/tests/auto/installer/commandlineupdate/settings.qrc
index a0a04a9e3..bed0619d8 100644
--- a/tests/auto/installer/commandlineupdate/settings.qrc
+++ b/tests/auto/installer/commandlineupdate/settings.qrc
@@ -10,6 +10,7 @@
<file>data/installPackagesRepository/componentF/1.0.0content.7z</file>
<file>data/installPackagesRepository/componentG/1.0.0content.7z</file>
<file>data/installPackagesRepository/componentG/1.0.0meta.7z</file>
+ <file>data/installPackagesRepository/componentH/1.0.0content.7z</file>
<file>data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z</file>
<file>data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z</file>
<file>data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z</file>
@@ -25,6 +26,7 @@
<file>data/installPackagesRepositoryUpdate/componentF/2.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentG/2.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentG/2.0.0meta.7z</file>
+ <file>data/installPackagesRepositoryUpdate/componentH/2.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent1/1.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent2/2.0.0content.7z</file>
<file>data/installPackagesRepositoryUpdate/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z</file>
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
index e465f8a75..5a25bbb39 100644
--- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
+++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
@@ -108,6 +108,30 @@ private slots:
core->setFoundEssentialUpdate(false);
}
+ void testUpdateForceUpdatePackagesSilently()
+ {
+ setRepository(":///data/installPackagesRepository");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << "componentH"));
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentH", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installContentAutoDependOnA.txt" << "installcontentH.txt");
+ core->commitSessionOperations();
+
+ setRepository(":///data/installPackagesRepositoryUpdate");
+ QCOMPARE(PackageManagerCore::EssentialUpdated, core->updateComponentsSilently(QStringList()));
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentH", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentH", "2.0.0content.txt");
+ //Verify that no other installed components got update
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installContentAutoDependOnA.txt" << "installcontentH_update.txt");
+ core->setFoundEssentialUpdate(false);
+ }
+
void testUpdatePackageSilently()
{
setRepository(":///data/installPackagesRepository");
@@ -122,7 +146,7 @@ private slots:
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
<< "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
<< "installcontentB.txt" << "installcontentD.txt"
- << "installContentAutoDependOnA.txt");
+ << "installContentAutoDependOnA.txt" << "installcontentH_update.txt");
core->commitSessionOperations();
setRepository(":///data/installPackagesRepositoryUpdate");
@@ -141,7 +165,7 @@ private slots:
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentA_update.txt"
<< "installcontentE_update.txt" << "installcontentG.txt"
<< "installcontentB_update.txt" << "installcontentD_update.txt"
- << "installContentAutoDependOnA.txt");
+ << "installContentAutoDependOnA.txt" << "installcontentH_update.txt");
}
void testUpdateNoUpdatesForSelectedPackage()
diff --git a/tests/auto/installer/shared/verifyinstaller.h b/tests/auto/installer/shared/verifyinstaller.h
index 4445743af..7cd2af05b 100644
--- a/tests/auto/installer/shared/verifyinstaller.h
+++ b/tests/auto/installer/shared/verifyinstaller.h
@@ -63,8 +63,10 @@ struct VerifyInstaller
static void verifyFileExistence(const QString &installDir, const QStringList &fileList)
{
- for (int i = 0; i < fileList.count(); i++)
- QVERIFY(QFileInfo::exists(installDir + QDir::separator() + fileList.at(i)));
+ for (int i = 0; i < fileList.count(); i++) {
+ bool fileExists = QFileInfo::exists(installDir + QDir::separator() + fileList.at(i));
+ QVERIFY2(fileExists, QString("File \"%1\" does not exist.").arg(fileList.at(i)).toLatin1());
+ }
QDir dir(installDir);
QCOMPARE(dir.entryList(QStringList() << "*.*", QDir::Files).count(), fileList.count());