summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2020-09-23 19:37:31 +0300
committerKatja Marttila <katja.marttila@qt.io>2020-09-25 10:32:30 +0300
commit02f8711dc250b4c4f07ea7b43cbb0904496b1cb3 (patch)
tree91357567cd4dfe0c0df14e2b21f5ef871fcce14e /tests
parent557feae54796a861f6076d30df17958e14debb4c (diff)
CLI: Give more meaningfull return value for installs
Instead of returning just true or false when running installer or maintenancetool, utilize the PackagemanagerCore status message. Added also a new status enum, EssentialUpdated, which is returned when calling command 'update' and only essential components are updated. Also fixed a bug when components could be installed even when there were an essential update available. Task-number: QTIFW-1969 Change-Id: I43826301656573b34e1338b49566d199bdcd7468 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/appendfileoperation/tst_appendfileoperation.cpp3
-rw-r--r--tests/auto/installer/cliinterface/tst_cliinterface.cpp112
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml1
-rw-r--r--tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml1
-rw-r--r--tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp74
-rw-r--r--tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp3
6 files changed, 145 insertions, 49 deletions
diff --git a/tests/auto/installer/appendfileoperation/tst_appendfileoperation.cpp b/tests/auto/installer/appendfileoperation/tst_appendfileoperation.cpp
index 27061fe4b..1b2d63fd7 100644
--- a/tests/auto/installer/appendfileoperation/tst_appendfileoperation.cpp
+++ b/tests/auto/installer/appendfileoperation/tst_appendfileoperation.cpp
@@ -127,7 +127,8 @@ private slots:
core->commitSessionOperations();
// We cannot check the file contents here as it will be deleted on
// undo Extract, but at least check that the uninstallation succeeds.
- QVERIFY(core->uninstallComponentsSilently(QStringList() << "A"));
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently
+ (QStringList()<< "A"));
QDir dir(installDir);
QVERIFY(dir.removeRecursively());
diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
index bdf57541f..9932adb41 100644
--- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp
+++ b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
@@ -96,19 +96,24 @@ private slots:
QTest::ignoreMessage(QtDebugMsg, "\"Preparing meta information download...\"");
QTest::ignoreMessage(QtDebugMsg, "Cannot install component A. Component is installed only as automatic dependency to autoDep.");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("A"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("A")));
QTest::ignoreMessage(QtDebugMsg, "\"Preparing meta information download...\"");
QTest::ignoreMessage(QtDebugMsg, "Cannot install component AB. Component is not checkable meaning you have to select one of the subcomponents.");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("AB"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("AB")));
QTest::ignoreMessage(QtDebugMsg, "\"Preparing meta information download...\"");
QTest::ignoreMessage(QtDebugMsg, "Cannot install B. Component is virtual.");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("B"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("B")));
QTest::ignoreMessage(QtDebugMsg, "\"Preparing meta information download...\"");
QTest::ignoreMessage(QtDebugMsg, "Cannot install MissingComponent. Component not found.");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("MissingComponent"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("MissingComponent")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
}
void testUninstallPackageFails()
@@ -126,16 +131,22 @@ private slots:
core.setValue(scTargetDir, m_installDir);
QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall ForcedInstallation component componentE");
- core.uninstallComponentsSilently(QStringList() << "componentE");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentE"));
QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component componentD because it is added as auto dependency to componentA,componentB");
- core.uninstallComponentsSilently(QStringList() << "componentD");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentD"));
QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component MissingComponent. Component not found in install tree.");
- core.uninstallComponentsSilently(QStringList() << "MissingComponent");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "MissingComponent"));
QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall virtual component componentH");
- core.uninstallComponentsSilently(QStringList() << "componentH");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentH"));
+
+ QCOMPARE(PackageManagerCore::Success, core.status());
}
void testListInstalledPackages()
@@ -164,7 +175,8 @@ private slots:
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
core->setNoDefaultInstallation(true);
- core->installDefaultComponentsSilently();
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
<< "installcontentE.txt");
core->setNoDefaultInstallation(false);
@@ -174,7 +186,9 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentE"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentE")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Depends on componentA
@@ -186,7 +200,9 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentA"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentA")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Depends on componentA
@@ -198,13 +214,16 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentA"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentA")));
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt"
- << "installcontentA.txt" << "installcontent.txt" << "installcontentG.txt");
+ << "installcontentA.txt" << "installcontent.txt" << "installcontentG.txt");
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << QLatin1String("componentA"));
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << QLatin1String("componentA")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentA");
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentG"); //Depends on componentA
@@ -215,13 +234,15 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentA"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentA")));
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt"
<< "installcontentA.txt" << "installcontent.txt" << "installcontentG.txt");
core->commitSessionOperations();
core->setUninstaller();
- QVERIFY(core->removeInstallationSilently());
+ QCOMPARE(PackageManagerCore::Success, core->removeInstallationSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentA");
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentE");
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentG");
@@ -239,7 +260,9 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentC"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentC")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentC
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt"); //Dependency for componentC
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
@@ -254,14 +277,17 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentC"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentC")));
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentC.txt"
<< "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
<< "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt");
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << QLatin1String("componentC"));
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << QLatin1String("componentC")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentC
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt"); //Dependency for componentC
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
@@ -277,7 +303,9 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentF.subcomponent2.subsubcomponent2"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentF.subcomponent2.subsubcomponent2")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF.subcomponent2.subsubcomponent2", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF.subcomponent2", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF", "1.0.0content.txt");
@@ -294,14 +322,18 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << QLatin1String("componentF.subcomponent2.subsubcomponent2"));
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("componentF.subcomponent2.subsubcomponent2")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentF.txt"
<< "installcontentF_2.txt" << "installcontentF_2_2.txt"
<< "installcontent.txt" << "installcontentA.txt"
<< "installcontentE.txt" << "installcontentG.txt");
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << QLatin1String("componentF.subcomponent2"));
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << QLatin1String("componentF.subcomponent2")));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentG
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Default install
@@ -317,7 +349,8 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installDefaultComponentsSilently();
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentG
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Default
@@ -329,13 +362,16 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installDefaultComponentsSilently();
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
<< "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << "componentG");
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentG"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentG
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentG");
@@ -347,10 +383,13 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installDefaultComponentsSilently();
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << "componentE");
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentE"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
//Nothing is uninstalled as componentE is forced install and cannot be uninstalled
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency for componentG
VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
@@ -363,10 +402,14 @@ private slots:
{
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << "componentA" << "componentB");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << "componentA" << "componentB"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << "componentD");
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentD"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
//Nothing is uninstalled as componentD is installed as autodependency to componentA and componentB
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt");
@@ -383,12 +426,16 @@ private slots:
PackageManagerCore *core = PackageManager::getPackageManagerWithInit
(m_installDir, ":///data/installPackagesRepository");
core->setVirtualComponentsVisible(true);
- core->installSelectedComponentsSilently(QStringList() <<"componentH");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ <<"componentH"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentH", "1.0.0content.txt");
core->commitSessionOperations();
core->setPackageManager();
- core->uninstallComponentsSilently(QStringList() << "componentH");
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentH"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentH");
}
@@ -408,7 +455,8 @@ private slots:
core->setFileDialogAutomaticAnswer("GetExistingDirectory", m_installDir);
core->setFileDialogAutomaticAnswer("GetExistingFile", testFile);
- core->installDefaultComponentsSilently();
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
QVERIFY(core->containsFileDialogAutomaticAnswer("ValidFile"));
core->removeFileDialogAutomaticAnswer("ValidFile");
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
index 824a6e21f..345b462d0 100644
--- a/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepository/Updates.xml
@@ -12,6 +12,7 @@
<UpdateFile OS="Any" CompressedSize="299" UncompressedSize="158"/>
<DownloadableArchives>content.7z</DownloadableArchives>
<SHA1>92b02a74d0886bc1569ff8b3a7edd1f9d828e56c</SHA1>
+ <Essential>true</Essential>
</PackageUpdate>
<PackageUpdate>
<Name>componentB</Name>
diff --git a/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
index f87a105b4..125289261 100644
--- a/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
+++ b/tests/auto/installer/commandlineupdate/data/installPackagesRepositoryUpdate/Updates.xml
@@ -12,6 +12,7 @@
<UpdateFile CompressedSize="297" UncompressedSize="99" OS="Any"/>
<DownloadableArchives>content.7z</DownloadableArchives>
<SHA1>43c8fcc544ea6d35fe5180a50d4764dcf9fd7473</SHA1>
+ <Essential>true</Essential>
</PackageUpdate>
<PackageUpdate>
<Name>componentB</Name>
diff --git a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
index 8d223ae09..7a61e9608 100644
--- a/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
+++ b/tests/auto/installer/commandlineupdate/tst_commandlineupdate.cpp
@@ -60,50 +60,93 @@ private slots:
core = PackageManager::getPackageManagerWithInit(m_installDir);
}
- void testUpdatePackageSilently()
+ void testInstallWhenEssentialUpdate()
{
setRepository(":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << "componentA" << "componentB");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << "componentA"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+ core->commitSessionOperations();
+ core->setPackageManager();
+ setRepository(":///data/installPackagesRepositoryUpdate");
+ QCOMPARE(PackageManagerCore::ForceUpdate, core->installSelectedComponentsSilently(QStringList()
+ << "componentB"));
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt");
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt");
VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt"
- << "installcontentB.txt" << "installcontentD.txt");
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+ }
+
+ void testUpdateEssentialPackageSilently()
+ {
+ 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");
+ 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 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, "componentB", "1.0.0content.txt");
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentA_update.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installcontentB.txt");
core->commitSessionOperations();
setRepository(":///data/installPackagesRepositoryUpdate");
- core->updateComponentsSilently(QStringList() << "componentA");
+ QCOMPARE(PackageManagerCore::Success, core->updateComponentsSilently(QStringList()
+ << "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, "componentB", "1.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::verifyInstallerResourceFileDeletion(m_installDir, "componentA", "1.0.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.txt" << "installcontentD_update.txt");
+ << "installcontentB_update.txt" << "installcontentD_update.txt");
}
void testUpdateNoUpdatesForSelectedPackage()
{
setRepository(":///data/installPackagesRepositoryUpdate");
// Succeeds as no updates available for component so nothing to do
- QVERIFY(core->updateComponentsSilently(QStringList() << "componentInvalid"));
+ QCOMPARE(PackageManagerCore::Success, core->updateComponentsSilently(QStringList()
+ << "componentInvalid"));
}
void testUpdateTwoPackageSilently()
{
setRepository(":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << "componentA" << "componentB" << "componentG");
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << "componentA" << "componentB" << "componentG"));
+ VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt");
core->commitSessionOperations();
setRepository(":///data/installPackagesRepositoryUpdate");
- core->updateComponentsSilently(QStringList() << "componentB" << "componentG");
+ QCOMPARE(PackageManagerCore::Success, core->updateComponentsSilently(QStringList()
+ << "componentB" << "componentG"));
VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentB", "1.0.0content.txt");
@@ -113,7 +156,8 @@ private slots:
void testUpdateAllPackagesSilently()
{
setRepository(":///data/installPackagesRepository");
- core->installSelectedComponentsSilently(QStringList() << "componentA" << "componentB" << "componentG" << "componentF");
+ QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
+ << "componentA" << "componentB" << "componentG" << "componentF"));
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF.subcomponent1", "1.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF.subcomponent1.subsubcomponent1", "1.0.0content.txt");
@@ -121,7 +165,7 @@ private slots:
core->commitSessionOperations();
setRepository(":///data/installPackagesRepositoryUpdate");
- core->updateComponentsSilently(QStringList());
+ QCOMPARE(PackageManagerCore::Success, core->updateComponentsSilently(QStringList()));
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResources(m_installDir, "componentF.subcomponent2", "2.0.0content.txt");
VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, "componentF", "1.0.0content.txt");
diff --git a/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp b/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp
index c8b970170..dafcd2676 100644
--- a/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp
+++ b/tests/auto/installer/packagemanagercore/tst_packagemanagercore.cpp
@@ -302,7 +302,8 @@ private slots:
const QRegularExpression re(warningMessage);
QTest::ignoreMessage(QtWarningMsg, re);
QTest::ignoreMessage(QtDebugMsg, "No updates available.");
- core.updateComponentsSilently(QStringList());
+
+ QCOMPARE(PackageManagerCore::Failure, core.updateComponentsSilently(QStringList()));
QVERIFY(QDir().rmdir(testDirectory));
}