summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-10 12:04:38 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-11 15:39:15 +0200
commita9f02505f780e84c0c99770682c5e3db94c3a0a1 (patch)
tree7aad0b05d32e1e18b3c8a41f7401594d0156bdcd /tests
parent2acb61dd465398f8ea1f340786674e9aec731871 (diff)
CLI: improvements to 'search' and 'install' command output
Previously subcomponents of a virtual component were shown on search results, and trying to install these would print a bit vague message: 'Component not found'. As the sub-branches of virtual component nodes are hidden on GUI, we should also hide them when using CLI search, and give a more appropriate error message why the component cannot be explicitly selected for installation, if the user still tries to do so. Also some minor refactoring to the handling of supplemental information about binary type of the running installer/mt. This change does not fix the possible case of an install script changing the 'virtual'-state of a component, as it would require downloading and evaluating the full metadata for repositories (or components), which would impose a performance penalty to search. Task-number: QTIFW-2168 Change-Id: Ibacaca23c38f5ea98967955d91849cefc1f11f61 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/cliinterface/data/repository/Updates.xml21
-rw-r--r--tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml10
-rw-r--r--tests/auto/installer/cliinterface/tst_cliinterface.cpp16
3 files changed, 46 insertions, 1 deletions
diff --git a/tests/auto/installer/cliinterface/data/repository/Updates.xml b/tests/auto/installer/cliinterface/data/repository/Updates.xml
index c7b11dc03..e5bc4f8af 100644
--- a/tests/auto/installer/cliinterface/data/repository/Updates.xml
+++ b/tests/auto/installer/cliinterface/data/repository/Updates.xml
@@ -35,6 +35,27 @@
<DownloadableArchives>content.7z</DownloadableArchives>
<SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
</PackageUpdate>
+ <PackageUpdate>
+ <Name>C.virt</Name>
+ <DisplayName>Virtual subcomponent of C</DisplayName>
+ <Description>Example virtual component</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <Virtual>true</Virtual>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
+ </PackageUpdate>
+ <PackageUpdate>
+ <Name>C.virt.subcomponent</Name>
+ <DisplayName>Subcomponent of virtual component</DisplayName>
+ <Description>Example subcomponent of virtual component</Description>
+ <Version>1.0.0-1</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <UpdateFile CompressedSize="222" OS="Any" UncompressedSize="72"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>5b3939da1af492382c68388fc796837e4c36b876</SHA1>
+ </PackageUpdate>
<PackageUpdate>
<Name>AB</Name>
<DisplayName>AB</DisplayName>
diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml
index e0aedffdd..f0c724db8 100644
--- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml
+++ b/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml
@@ -37,4 +37,14 @@
<SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1>
<Virtual>true</Virtual>
</PackageUpdate>
+ <PackageUpdate>
+ <Name>B.subcomponent</Name>
+ <DisplayName>Subcomponent of B</DisplayName>
+ <Description>Example non-virtual subcomponent of B</Description>
+ <Version>2.0.0</Version>
+ <ReleaseDate>2015-01-01</ReleaseDate>
+ <UpdateFile CompressedSize="224" OS="Any" UncompressedSize="74"/>
+ <DownloadableArchives>content.7z</DownloadableArchives>
+ <SHA1>cfa136fa1d7a4196896c90af72d510727ba799ae</SHA1>
+ </PackageUpdate>
</Updates>
diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
index 550f45da2..98ea99133 100644
--- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp
+++ b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -89,6 +89,15 @@ private slots:
" <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
"</availablepackages>\n");
core->listAvailablePackages(QLatin1String("^C"));
+
+ // Need to change rules here to catch messages
+ QLoggingCategory::setFilterRules("ifw.* = true\n");
+
+ QTest::ignoreMessage(QtDebugMsg, "No matching packages found.");
+ core->listAvailablePackages(QLatin1String("C.virt"));
+
+ QTest::ignoreMessage(QtDebugMsg, "No matching packages found.");
+ core->listAvailablePackages(QLatin1String("C.virt.subcomponent"));
}
void testInstallPackageFails()
@@ -117,6 +126,11 @@ private slots:
<< QLatin1String("B")));
QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, "Cannot install B.subcomponent. Component is descendant of a virtual component B.\n");
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("B.subcomponent")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
QTest::ignoreMessage(QtDebugMsg, "Cannot install MissingComponent. Component not found.\n");
QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
<< QLatin1String("MissingComponent")));