summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatja Marttila <katja.marttila@qt.io>2022-06-02 10:46:14 +0300
committerKatja Marttila <katja.marttila@qt.io>2022-06-06 14:12:13 +0300
commitfdfd2e381bd16a99822ef8c9dfdffb75ab29d142 (patch)
treec97aa34d0e11907c8f65978a7aecc7c088e9d341
parentb6e6ad4876ab6c2c2a20f6cce191e27411441921 (diff)
Convert possible test cases to data-driven tests
Also rename the test to better correspond the test cases. Change-Id: Ic3f624fc8cf42724ff4df550cc85a52343ac6452 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
-rw-r--r--tests/auto/installer/cliinterface/tst_cliinterface.cpp602
-rw-r--r--tests/auto/installer/commandlineinstall/commandlineinstall.pro (renamed from tests/auto/installer/cliinterface/cliinterface.pro)2
-rw-r--r--tests/auto/installer/commandlineinstall/data/components.xml (renamed from tests/auto/installer/cliinterface/data/components.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml (renamed from tests/auto/installer/cliinterface/data/componentsFromInstallPackagesRepository.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/config.xml (renamed from tests/auto/installer/cliinterface/data/config.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z (renamed from tests/auto/installer/cliinterface/data/filequeryrepository/A/1.0.2-1meta.7z)bin945 -> 945 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml (renamed from tests/auto/installer/cliinterface/data/filequeryrepository/Updates.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/Updates.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentA/2.0.0content.7z)bin259 -> 259 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentB/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentC/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentD/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentF/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentH/1.0.0content.7z)bin209 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/Updates.xml)2
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentA/1.0.0content.7z)bin259 -> 259 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentB/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentC/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentD/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentE/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z)bin249 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z)bin249 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z)bin249 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z)bin249 -> 249 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentF/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0content.7z)bin241 -> 241 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0meta.7z)bin970 -> 970 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentH/1.0.0content.7z)bin209 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z (renamed from tests/auto/installer/cliinterface/data/installPackagesRepository/componentI/1.0.0content.7z)bin209 -> 209 bytes
-rw-r--r--tests/auto/installer/commandlineinstall/data/repository/Updates.xml (renamed from tests/auto/installer/cliinterface/data/repository/Updates.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml (renamed from tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml)0
-rw-r--r--tests/auto/installer/commandlineinstall/settings.qrc (renamed from tests/auto/installer/cliinterface/settings.qrc)0
-rw-r--r--tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp764
-rw-r--r--tests/auto/installer/installer.pro2
36 files changed, 768 insertions, 604 deletions
diff --git a/tests/auto/installer/cliinterface/tst_cliinterface.cpp b/tests/auto/installer/cliinterface/tst_cliinterface.cpp
deleted file mode 100644
index 8f1784543..000000000
--- a/tests/auto/installer/cliinterface/tst_cliinterface.cpp
+++ /dev/null
@@ -1,602 +0,0 @@
-/**************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Installer Framework.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-**************************************************************************/
-#include "../shared/packagemanager.h"
-#include "../shared/verifyinstaller.h"
-
-#include <component.h>
-#include <packagemanagercore.h>
-
-#include <QLoggingCategory>
-#include <QTest>
-#include <QRegularExpression>
-
-#include <iostream>
-#include <sstream>
-
-using namespace QInstaller;
-
-class tst_CLIInterface : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testListAvailablePackages()
- {
- QString loggingRules = (QLatin1String("ifw.* = false\n"));
-
- QTest::ignoreMessage(QtDebugMsg, "Operations sanity check succeeded.");
-
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
- (m_installDir, ":///data/repository"));
-
- QLoggingCategory::setFilterRules(loggingRules);
- auto func = &PackageManagerCore::listAvailablePackages;
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
- " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
- " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
- " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("."), QHash<QString, QString>());
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
- " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("A"), QHash<QString, QString>());
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
- " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("A.*"), QHash<QString, QString>());
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("^B"), QHash<QString, QString>());
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("^B.*"), QHash<QString, QString>());
-
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
- "</availablepackages>\n"), func, QLatin1String("^C"), QHash<QString, QString>());
-
- // Test with filters
- QHash<QString, QString> searchHash {
- { "Version", "1.0.2" },
- { "DisplayName", "A" }
- };
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
- " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
- "</availablepackages>\n"), func, QString(), searchHash);
-
- searchHash.clear();
- searchHash.insert("Default", "false");
- verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
- "<availablepackages>\n"
- " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
- "</availablepackages>\n"), func, QString(), searchHash);
-
- // 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()
- {
- QString loggingRules = (QLatin1String("ifw.* = false\n"
- "ifw.installer.installlog = true\n"));
-
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
- (m_installDir, ":///data/uninstallableComponentsRepository"));
-
- QLoggingCategory::setFilterRules(loggingRules);
-
- QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
- QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component A. Component "
- "is installed only as automatic dependency to autoDep.\n"));
- QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("A")));
-
- QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
- QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component AB. Component "
- "is not checkable, meaning you have to select one of the subcomponents.\n"));
- QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("AB")));
-
- QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
- QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B. Component is virtual.\n"));
- QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("B")));
-
- QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
- QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B.subcomponent. Component "
- "is a 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, QRegularExpression("Cannot install MissingComponent. "
- "Component not found.\n"));
- QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("MissingComponent")));
- QCOMPARE(PackageManagerCore::Canceled, core->status());
- }
-
- void testUninstallPackageFails()
- {
- QString loggingRules = (QLatin1String("ifw.installer.installog = true\n"));
- PackageManagerCore core;
- core.setPackageManager();
- QString appFilePath = QCoreApplication::applicationFilePath();
- core.setAllowedRunningProcesses(QStringList() << appFilePath);
- QLoggingCategory::setFilterRules(loggingRules);
-
- m_installDir = QInstaller::generateTemporaryFileName();
- QVERIFY(QDir().mkpath(m_installDir));
- QVERIFY(QFile::copy(":/data/componentsFromInstallPackagesRepository.xml", m_installDir + "/components.xml"));
-
- core.setValue(scTargetDir, m_installDir);
- QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall ForcedInstallation component 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");
- QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
- << "componentD"));
-
- QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component MissingComponent. Component not found in install tree.");
- QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
- << "MissingComponent"));
-
- QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall virtual component componentH");
- QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
- << "componentH"));
-
- QCOMPARE(PackageManagerCore::Success, core.status());
- }
-
- void testListInstalledPackages()
- {
- QString loggingRules = (QLatin1String("ifw.* = false\n"));
- PackageManagerCore core;
- core.setPackageManager();
- QLoggingCategory::setFilterRules(loggingRules);
- auto func = &PackageManagerCore::listInstalledPackages;
-
- const QString testDirectory = QInstaller::generateTemporaryFileName();
- QVERIFY(QDir().mkpath(testDirectory));
- QVERIFY(QFile::copy(":/data/components.xml", testDirectory + "/components.xml"));
-
- core.setValue(scTargetDir, testDirectory);
-
- verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
- "<localpackages>\n"
- " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
- " <package name=\"B\" displayname=\"B Title\" version=\"1.0.0-1\"/>\n"
- "</localpackages>\n"), func, QString());
-
- verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
- "<localpackages>\n"
- " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
- "</localpackages>\n"), func, QLatin1String("A"));
-
- QDir dir(testDirectory);
- QVERIFY(dir.removeRecursively());
- }
-
- void testNoDefaultInstallations()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- core->setNoDefaultInstallation(true);
- QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
- QCOMPARE(PackageManagerCore::Success, core->status());
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontentE.txt");
- core->setNoDefaultInstallation(false);
- }
-
- void testInstallForcedPackageSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testInstallPackageSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testUninstallPackageSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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->setPackageManager();
- 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
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentE.txt");
- }
-
- void testRemoveAllSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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();
- 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");
-
- // On Windows we have to settle for the resources check above as maintenance
- // tool (if it would exists) and target directory are only removed later via
- // started VBScript process. On Unix platforms the target directory should
- // be removed in PackageManagerCorePrivate::runUninstaller().
-#if defined(Q_OS_UNIX)
- QVERIFY(!QDir(m_installDir).exists());
-#endif
- }
-
- void testInstallWithDependencySilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Depends on componentA
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentI", "1.0.0content.txt"); //Virtual, depends on componentC
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt"); //Autodepend on componentA and componentB
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentC.txt"
- << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
- << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt" << "installcontentI.txt");
- }
-
- void testUninstallWithDependencySilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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" << "installcontentI.txt");
-
- core->commitSessionOperations();
- core->setPackageManager();
- 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
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Depends on componentA
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt"); //Autodepend on componentA and componentB
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentC");
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentI"); //Virtual, depends on componentC
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
- << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testInstallSubcomponentSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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");
- 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
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontentF.txt"
- << "installcontentF_2.txt" << "installcontentF_2_2.txt"
- << "installcontent.txt" << "installcontentA.txt"
- << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testUninstallSubcomponentSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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();
- 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
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentF.subcomponent2.subsubcomponent2");
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentF.subcomponent2");
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentF");
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontent.txt" << "installcontentA.txt"
- << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testInstallDefaultPackagesSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testInstallPackagesWithChangedRepository()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- core->setNoDefaultInstallation(true);
- QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("componentC")));
-
- QCOMPARE(PackageManagerCore::Success, core->status());
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentA", "1.0.0content.txt"); //Dependency to componentC
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentB", "1.0.0content.txt"); //Dependency to componentC
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentC", "1.0.0content.txt"); //Selected
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt"); //Autodepend on componentA,componentB
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //AutodependOn componentC
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentI", "1.0.0content.txt"); //Virtual dependency to componentC
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
- << "installcontentC.txt" << "installcontentD.txt" << "installcontentE.txt"
- << "installcontentI.txt");
-
- core->reset();
- core->cancelMetaInfoJob(); //Call cancel to reset metadata so that update repositories are fetched
-
- QSet<Repository> repoList;
- Repository repo = Repository::fromUserInput(":///data/installPackagesDependencyChanged");
- repoList.insert(repo);
- core->settings().setDefaultRepositories(repoList);
-
- QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
- << QLatin1String("componentH")));
- // New dependency is added in repository from componentA to componentF, check that it is not installed
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentF");
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
- << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
- << "installcontentC.txt" << "installcontentD.txt" << "installcontentE.txt"
- << "installcontentI.txt" << "installcontentH.txt");
- core->setNoDefaultInstallation(false);
- }
-
- void testUnInstallDefaultPackagesSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- 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();
- 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");
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt");
- }
-
- void testUninstallForcedPackagesSilenly()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
- QCOMPARE(PackageManagerCore::Success, core->status());
- core->commitSessionOperations();
- core->setPackageManager();
- 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
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Default
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
- }
-
- void testUninstallAutodependencyPackagesSilenly()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- QCOMPARE(PackageManagerCore::Success, core->installSelectedComponentsSilently(QStringList()
- << "componentA" << "componentB"));
- QCOMPARE(PackageManagerCore::Success, core->status());
- core->commitSessionOperations();
- core->setPackageManager();
- 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");
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentD", "1.0.0content.txt");
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentE", "1.0.0content.txt"); //ForcedInstall
- VerifyInstaller::verifyInstallerResources(m_installDir, "componentG", "1.0.0content.txt"); //Default
- VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
- << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt"
- << "installcontentB.txt" << "installcontentD.txt");
- }
-
- void testUninstallVirtualSetVisibleSilently()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
- (m_installDir, ":///data/installPackagesRepository"));
- core->setVirtualComponentsVisible(true);
- 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();
- QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
- << "componentH"));
- QCOMPARE(PackageManagerCore::Success, core->status());
- VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentH");
- }
-
- void testFileQuery()
- {
- QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit(m_installDir,
- ":///data/filequeryrepository"));
- core->setCommandLineInstance(true);
- core->setFileDialogAutomaticAnswer("ValidDirectory", m_installDir);
-
- QString testFile = qApp->applicationDirPath() + QDir::toNativeSeparators("/test");
- QFile file(testFile);
- QVERIFY(file.open(QIODevice::WriteOnly));
- core->setFileDialogAutomaticAnswer("ValidFile", testFile);
-
- //File dialog launched without ID
- core->setFileDialogAutomaticAnswer("GetExistingDirectory", m_installDir);
- core->setFileDialogAutomaticAnswer("GetExistingFile", testFile);
-
- QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
- QCOMPARE(PackageManagerCore::Success, core->status());
-
- QVERIFY(core->containsFileDialogAutomaticAnswer("ValidFile"));
- core->removeFileDialogAutomaticAnswer("ValidFile");
- QVERIFY(!core->containsFileDialogAutomaticAnswer("ValidFile"));
-
- QVERIFY(file.remove());
- core->deleteLater();
- }
-
- void init()
- {
- m_installDir = QInstaller::generateTemporaryFileName();
- QVERIFY(QDir().mkpath(m_installDir));
- }
-
- void initTestCase()
- {
- qSetGlobalQHashSeed(0); //Ensures the dom document deterministic behavior
- }
-
- void cleanup()
- {
- QDir dir(m_installDir);
- QVERIFY(dir.removeRecursively());
- }
-
-private:
- template <typename Func, typename... Args>
- void verifyListPackagesMessage(PackageManagerCore *core, const QString &message,
- Func func, Args... args)
- {
- std::ostringstream stream;
- std::streambuf *buf = std::cout.rdbuf();
- std::cout.rdbuf(stream.rdbuf());
-
- (core->*func)(std::forward<Args>(args)...);
-
- std::cout.rdbuf(buf);
- QVERIFY(stream && stream.str() == message.toStdString());
- }
-
-private:
- QString m_installDir;
-};
-
-
-QTEST_MAIN(tst_CLIInterface)
-
-#include "tst_cliinterface.moc"
diff --git a/tests/auto/installer/cliinterface/cliinterface.pro b/tests/auto/installer/commandlineinstall/commandlineinstall.pro
index db2a3138a..891830a97 100644
--- a/tests/auto/installer/cliinterface/cliinterface.pro
+++ b/tests/auto/installer/commandlineinstall/commandlineinstall.pro
@@ -2,7 +2,7 @@ include(../../qttest.pri)
QT += qml
-SOURCES += tst_cliinterface.cpp
+SOURCES += tst_commandlineinstall.cpp
RESOURCES += \
settings.qrc \
diff --git a/tests/auto/installer/cliinterface/data/components.xml b/tests/auto/installer/commandlineinstall/data/components.xml
index d5102787f..d5102787f 100644
--- a/tests/auto/installer/cliinterface/data/components.xml
+++ b/tests/auto/installer/commandlineinstall/data/components.xml
diff --git a/tests/auto/installer/cliinterface/data/componentsFromInstallPackagesRepository.xml b/tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml
index 18d6f11c3..18d6f11c3 100644
--- a/tests/auto/installer/cliinterface/data/componentsFromInstallPackagesRepository.xml
+++ b/tests/auto/installer/commandlineinstall/data/componentsFromInstallPackagesRepository.xml
diff --git a/tests/auto/installer/cliinterface/data/config.xml b/tests/auto/installer/commandlineinstall/data/config.xml
index 041ce5062..041ce5062 100644
--- a/tests/auto/installer/cliinterface/data/config.xml
+++ b/tests/auto/installer/commandlineinstall/data/config.xml
diff --git a/tests/auto/installer/cliinterface/data/filequeryrepository/A/1.0.2-1meta.7z b/tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z
index 0b0b6ade6..0b0b6ade6 100644
--- a/tests/auto/installer/cliinterface/data/filequeryrepository/A/1.0.2-1meta.7z
+++ b/tests/auto/installer/commandlineinstall/data/filequeryrepository/A/1.0.2-1meta.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/filequeryrepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml
index 72b7938d9..72b7938d9 100644
--- a/tests/auto/installer/cliinterface/data/filequeryrepository/Updates.xml
+++ b/tests/auto/installer/commandlineinstall/data/filequeryrepository/Updates.xml
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/Updates.xml b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml
index 72931954a..72931954a 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/Updates.xml
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/Updates.xml
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentA/2.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z
index 4ddbe565b..4ddbe565b 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentA/2.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentA/2.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentB/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z
index f84ffcdc5..f84ffcdc5 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentB/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentB/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentC/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z
index 9ad11e06f..9ad11e06f 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentC/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentC/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentD/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z
index 0c8c52e31..0c8c52e31 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentD/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentD/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentF/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z
index 4a04b1394..4a04b1394 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentF/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentF/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentH/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z
index e1449ad29..e1449ad29 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesDependencyChanged/componentH/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesDependencyChanged/componentH/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml
index adabceab4..81831ed5b 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/Updates.xml
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/Updates.xml
@@ -151,6 +151,7 @@
</PackageUpdate>
<PackageUpdate>
<Name>componentH</Name>
+ <DisplayName>component H</DisplayName>
<Description>This component does not depend on any other component.</Description>
<Version>1.0.0</Version>
<ReleaseDate>2014-08-25</ReleaseDate>
@@ -160,6 +161,7 @@
</PackageUpdate>
<PackageUpdate>
<Name>componentI</Name>
+ <DisplayName>component I</DisplayName>
<Description>This component has an automatic dependency on Component C. If C is marked for installation, this component is also installed.</Description>
<Version>1.0.0</Version>
<ReleaseDate>2014-08-25</ReleaseDate>
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentA/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z
index 4ddbe565b..4ddbe565b 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentA/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentA/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentB/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z
index f84ffcdc5..f84ffcdc5 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentB/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentB/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentC/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z
index 9ad11e06f..9ad11e06f 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentC/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentC/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentD/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z
index 0c8c52e31..0c8c52e31 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentD/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentD/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentE/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z
index f5abacf81..f5abacf81 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentE/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentE/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z
index 3aced680f..3aced680f 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z
index e5385a163..e5385a163 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1.subsubcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z
index 5bc549863..5bc549863 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z
index da9e9f340..da9e9f340 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent1/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z
index d0b013706..d0b013706 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2.subsubcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z
index 74ab44033..74ab44033 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF.subcomponent2/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z
index 4a04b1394..4a04b1394 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentF/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentF/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z
index 81fc02052..81fc02052 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0meta.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z
index 90bfe33a2..90bfe33a2 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentG/1.0.0meta.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentG/1.0.0meta.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentH/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z
index e1449ad29..e1449ad29 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentH/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentH/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentI/1.0.0content.7z b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z
index 651a29f94..651a29f94 100644
--- a/tests/auto/installer/cliinterface/data/installPackagesRepository/componentI/1.0.0content.7z
+++ b/tests/auto/installer/commandlineinstall/data/installPackagesRepository/componentI/1.0.0content.7z
Binary files differ
diff --git a/tests/auto/installer/cliinterface/data/repository/Updates.xml b/tests/auto/installer/commandlineinstall/data/repository/Updates.xml
index 52707d09d..52707d09d 100644
--- a/tests/auto/installer/cliinterface/data/repository/Updates.xml
+++ b/tests/auto/installer/commandlineinstall/data/repository/Updates.xml
diff --git a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml b/tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml
index f0c724db8..f0c724db8 100644
--- a/tests/auto/installer/cliinterface/data/uninstallableComponentsRepository/Updates.xml
+++ b/tests/auto/installer/commandlineinstall/data/uninstallableComponentsRepository/Updates.xml
diff --git a/tests/auto/installer/cliinterface/settings.qrc b/tests/auto/installer/commandlineinstall/settings.qrc
index 824517e1e..824517e1e 100644
--- a/tests/auto/installer/cliinterface/settings.qrc
+++ b/tests/auto/installer/commandlineinstall/settings.qrc
diff --git a/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp b/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp
new file mode 100644
index 000000000..89f6153ed
--- /dev/null
+++ b/tests/auto/installer/commandlineinstall/tst_commandlineinstall.cpp
@@ -0,0 +1,764 @@
+/**************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Installer Framework.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+**************************************************************************/
+#include "../shared/packagemanager.h"
+#include "../shared/verifyinstaller.h"
+
+#include <component.h>
+#include <packagemanagercore.h>
+
+#include <QLoggingCategory>
+#include <QTest>
+#include <QRegularExpression>
+
+#include <iostream>
+#include <sstream>
+
+using namespace QInstaller;
+
+typedef QList<QPair<QString, QString> > ComponentResourceHash;
+typedef QPair<QString, QString> ComponentResource;
+
+class tst_CommandLineInstall : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testListAvailablePackages()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"));
+
+ QTest::ignoreMessage(QtDebugMsg, "Operations sanity check succeeded.");
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
+ (m_installDir, ":///data/repository"));
+
+ QLoggingCategory::setFilterRules(loggingRules);
+ auto func = &PackageManagerCore::listAvailablePackages;
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("."), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("A"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("A.*"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^B"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^B.*"), QHash<QString, QString>());
+
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"C\" displayname=\"C\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QLatin1String("^C"), QHash<QString, QString>());
+
+ // Test with filters
+ QHash<QString, QString> searchHash {
+ { "Version", "1.0.2" },
+ { "DisplayName", "A" }
+ };
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"AB\" displayname=\"AB\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"A\" displayname=\"A\" version=\"1.0.2-1\"/>\n"
+ "</availablepackages>\n"), func, QString(), searchHash);
+
+ searchHash.clear();
+ searchHash.insert("Default", "false");
+ verifyListPackagesMessage(core.get(), QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<availablepackages>\n"
+ " <package name=\"B\" displayname=\"B\" version=\"1.0.0-1\"/>\n"
+ "</availablepackages>\n"), func, QString(), searchHash);
+
+ // 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()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"
+ "ifw.installer.installlog = true\n"));
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManager
+ (m_installDir, ":///data/uninstallableComponentsRepository"));
+
+ QLoggingCategory::setFilterRules(loggingRules);
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component A. Component "
+ "is installed only as automatic dependency to autoDep.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("A")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install component AB. Component "
+ "is not checkable, meaning you have to select one of the subcomponents.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("AB")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B. Component is virtual.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("B")));
+
+ QTest::ignoreMessage(QtDebugMsg, "Preparing meta information download...");
+ QTest::ignoreMessage(QtDebugMsg, QRegularExpression("Cannot install B.subcomponent. Component "
+ "is a 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, QRegularExpression("Cannot install MissingComponent. "
+ "Component not found.\n"));
+ QCOMPARE(PackageManagerCore::Canceled, core->installSelectedComponentsSilently(QStringList()
+ << QLatin1String("MissingComponent")));
+ QCOMPARE(PackageManagerCore::Canceled, core->status());
+ }
+
+ void testUninstallPackageFails()
+ {
+ QString loggingRules = (QLatin1String("ifw.installer.installog = true\n"));
+ PackageManagerCore core;
+ core.setPackageManager();
+ QString appFilePath = QCoreApplication::applicationFilePath();
+ core.setAllowedRunningProcesses(QStringList() << appFilePath);
+ QLoggingCategory::setFilterRules(loggingRules);
+
+ QVERIFY(QFile::copy(":/data/componentsFromInstallPackagesRepository.xml", m_installDir + "/components.xml"));
+
+ core.setValue(scTargetDir, m_installDir);
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall ForcedInstallation component 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");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentD"));
+
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall component MissingComponent. Component not found in install tree.");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "MissingComponent"));
+
+ QTest::ignoreMessage(QtWarningMsg, "Cannot uninstall virtual component componentH");
+ QCOMPARE(PackageManagerCore::Success, core.uninstallComponentsSilently(QStringList()
+ << "componentH"));
+
+ QCOMPARE(PackageManagerCore::Success, core.status());
+ }
+
+ void testListInstalledPackages()
+ {
+ QString loggingRules = (QLatin1String("ifw.* = false\n"));
+ PackageManagerCore core;
+ core.setPackageManager();
+ QLoggingCategory::setFilterRules(loggingRules);
+ auto func = &PackageManagerCore::listInstalledPackages;
+
+ const QString testDirectory = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(testDirectory));
+ QVERIFY(QFile::copy(":/data/components.xml", testDirectory + "/components.xml"));
+
+ core.setValue(scTargetDir, testDirectory);
+
+ verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<localpackages>\n"
+ " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
+ " <package name=\"B\" displayname=\"B Title\" version=\"1.0.0-1\"/>\n"
+ "</localpackages>\n"), func, QString());
+
+ verifyListPackagesMessage(&core, QLatin1String("<?xml version=\"1.0\"?>\n"
+ "<localpackages>\n"
+ " <package name=\"A\" displayname=\"A Title\" version=\"1.0.2-1\"/>\n"
+ "</localpackages>\n"), func, QLatin1String("A"));
+
+ QDir dir(testDirectory);
+ QVERIFY(dir.removeRecursively());
+ }
+
+ void testInstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+
+ /*********** Forced installation **********/
+ ComponentResourceHash componentResources;
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+
+ QTest::newRow("Forced installation")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentE")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+
+ /*********** Simple installation **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+
+ QTest::newRow("Simple installation")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+
+ /*********** Install with dependency **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt")); //Dependency for componentC
+ componentResources.append(ComponentResource("componentB", "1.0.0content.txt")); //Dependency for componentC
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Depends on componentA
+ componentResources.append(ComponentResource("componentI", "1.0.0content.txt")); //Virtual, depends on componentC
+ componentResources.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA and componentB
+
+ QTest::newRow("Install with dependency")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontentC.txt"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt"
+ << "installcontentI.txt");
+
+ /*********** Install with subcomponents **********/
+ componentResources.clear();
+ componentResources.append(ComponentResource("componentF.subcomponent2.subsubcomponent2", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentF.subcomponent2", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+ componentResources.append(ComponentResource("componentA", "1.0.0content.txt")); //Dependency for componentG
+ componentResources.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResources.append(ComponentResource("componentG", "1.0.0content.txt")); //Default install
+
+ QTest::newRow("Install with subcomponents")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentF.subcomponent2.subsubcomponent2")
+ << PackageManagerCore::Success
+ << componentResources
+ << (QStringList() << "components.xml" << "installcontentF.txt"
+ << "installcontentF_2.txt" << "installcontentF_2_2.txt"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt");
+ }
+
+ void testInstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+
+ QCOMPARE(status, core->installSelectedComponentsSilently(QStringList() << installComponents));
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+ }
+
+ void testUninstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+ QTest::addColumn<QStringList>("uninstallComponents");
+ QTest::addColumn<PackageManagerCore::Status>("uninstallStatus");
+ QTest::addColumn<ComponentResourceHash>("componentResourcesAfterUninstall");
+ QTest::addColumn<QStringList >("installedFilesAfterUninstall");
+ QTest::addColumn<ComponentResourceHash >("deletedComponentResources");
+ QTest::addColumn<bool >("virtualSetVisible");
+
+ /*********** Uninstallation **********/
+ ComponentResourceHash componentResourcesAfterUninstall;
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+
+ ComponentResourceHash deletedComponentResources;
+ deletedComponentResources.append(ComponentResource("componentA", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentG", "1.0.0content.txt"));
+
+ ComponentResourceHash componentResourceAfterInstall;
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ QStringList filesAfterUninstall;
+ filesAfterUninstall << "components.xml" << "installcontentE.txt";
+
+ QStringList filesAfterInstall;
+ filesAfterInstall << filesAfterUninstall << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentG.txt";
+
+ QTest::newRow("Test uninstall")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentA")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall with dependency **********/
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentB", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentG", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentD", "1.0.0content.txt"));
+
+ deletedComponentResources.clear();
+ deletedComponentResources.append(ComponentResource("componentC", "1.0.0content.txt")); //Unselected
+ deletedComponentResources.append(ComponentResource("componentI", "1.0.0content.txt")); //Autodepends on componentC
+
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentD.txt"<< "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterInstall.clear();
+ filesAfterInstall << filesAfterUninstall << "installcontentC.txt"
+ << "installcontentI.txt";
+
+
+ QTest::newRow("Uninstall with dependency")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall with subcomponents **********/
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall.append(ComponentResource("componentA", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentE", "1.0.0content.txt"));
+ componentResourcesAfterUninstall.append(ComponentResource("componentG", "1.0.0content.txt"));
+
+ deletedComponentResources.clear();
+ deletedComponentResources.append(ComponentResource("componentF.subcomponent2.subsubcomponent2", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentF.subcomponent2", "1.0.0content.txt"));
+ deletedComponentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall << deletedComponentResources << componentResourcesAfterUninstall;
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontentF.txt"
+ << "installcontentF_2.txt" << "installcontentF_2_2.txt"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt"
+ << "installcontentE.txt" << "installcontentG.txt";
+
+ QTest::newRow("Uninstall with subcomponents")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentF.subcomponent2.subsubcomponent2")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentF.subcomponent2")
+ << PackageManagerCore::Success
+ << componentResourcesAfterUninstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall forced packages **********/
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentG depends
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall = componentResourceAfterInstall; //forced packages cannot be uninstalled
+
+ deletedComponentResources.clear();
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt";
+
+ filesAfterUninstall.clear();
+ filesAfterUninstall = filesAfterInstall;
+
+ QTest::newRow("Uninstall forced packages")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentG")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentE")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+
+ /*********** Uninstall autodependency packages **********/
+ componentResourceAfterInstall.clear();
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentG depends
+ componentResourceAfterInstall.append(ComponentResource("componentB", "1.0.0content.txt")); //Dependency for componentC
+ componentResourceAfterInstall.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA and componentB
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //ForcedInstall
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+
+ componentResourcesAfterUninstall.clear();
+ componentResourcesAfterUninstall = componentResourceAfterInstall; //autodependency packages cannot be uninstalled
+
+ deletedComponentResources.clear();
+
+ filesAfterInstall.clear();
+ filesAfterInstall << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt"
+ << "installcontentB.txt" << "installcontentD.txt";
+ filesAfterUninstall.clear();
+ filesAfterUninstall = filesAfterInstall;
+
+ QTest::newRow("Uninstall autodependency packages")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentA" << "componentB")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << (QStringList() << "componentD")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterUninstall
+ << deletedComponentResources;
+ }
+
+ void testUninstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+ QFETCH(QStringList, uninstallComponents);
+ QFETCH(PackageManagerCore::Status, uninstallStatus);
+ QFETCH(ComponentResourceHash, componentResourcesAfterUninstall);
+ QFETCH(QStringList, installedFilesAfterUninstall);
+ QFETCH(ComponentResourceHash, deletedComponentResources);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+
+ QCOMPARE(status, core->installSelectedComponentsSilently(QStringList() << installComponents));
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+ core->commitSessionOperations();
+ core->setPackageManager();
+
+ QCOMPARE(uninstallStatus, core->uninstallComponentsSilently(QStringList()
+ << uninstallComponents));
+ QCOMPARE(uninstallStatus, core->status());
+ for (const ComponentResource &resource : componentResourcesAfterUninstall)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ for (const ComponentResource &resource : deletedComponentResources)
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFilesAfterUninstall);
+ }
+
+ void addToExistingInstall_data()
+ {
+ QTest::addColumn<QString>("repository");
+ QTest::addColumn<QStringList>("installComponents");
+ QTest::addColumn<PackageManagerCore::Status>("status");
+ QTest::addColumn<ComponentResourceHash>("componentResources");
+ QTest::addColumn<QStringList >("installedFiles");
+ QTest::addColumn<QString>("newRepository");
+ QTest::addColumn<QStringList>("installNewComponents");
+ QTest::addColumn<PackageManagerCore::Status>("reinstallStatus");
+ QTest::addColumn<ComponentResourceHash>("componentResourcesAfterReinstall");
+ QTest::addColumn<QStringList >("installedFilesAfterReinstall");
+ QTest::addColumn<ComponentResourceHash >("deletedComponentResources");
+
+ /*********** New dependency in repository **********/
+ ComponentResourceHash componentResourceAfterInstall;
+ componentResourceAfterInstall.append(ComponentResource("componentA", "1.0.0content.txt")); //ComponentC depends on
+ componentResourceAfterInstall.append(ComponentResource("componentB", "1.0.0content.txt")); //ComponentC depends on
+ componentResourceAfterInstall.append(ComponentResource("componentC", "1.0.0content.txt")); //Selected
+ componentResourceAfterInstall.append(ComponentResource("componentD", "1.0.0content.txt")); //Autodepend on componentA,componentB
+ componentResourceAfterInstall.append(ComponentResource("componentE", "1.0.0content.txt")); //Forced
+ componentResourceAfterInstall.append(ComponentResource("componentG", "1.0.0content.txt")); //Default
+ componentResourceAfterInstall.append(ComponentResource("componentI", "1.0.0content.txt")); //Autodepend componentC
+
+ ComponentResourceHash componentResourcesAfterReinstall;
+ componentResourcesAfterReinstall = componentResourceAfterInstall;
+ componentResourcesAfterReinstall.append(ComponentResource("componentH", "1.0.0content.txt"));
+
+ ComponentResourceHash deletedComponentResources;
+ // New dependency is added in repository from componentA to componentF, check that it is not installed
+ deletedComponentResources.append(ComponentResource("componentF", "1.0.0content.txt"));
+
+ QStringList filesAfterInstall;
+ filesAfterInstall << "components.xml"
+ << "installcontent.txt" << "installcontentA.txt" << "installcontentB.txt"
+ << "installcontentC.txt" << "installcontentD.txt" << "installcontentE.txt"
+ << "installcontentG.txt" << "installcontentI.txt";
+
+ QStringList filesAfterReinstall;
+ filesAfterReinstall = filesAfterInstall;
+ filesAfterReinstall << "installcontentH.txt";
+
+ QTest::newRow("New dependency in repository")
+ << ":///data/installPackagesRepository"
+ << (QStringList() << "componentC")
+ << PackageManagerCore::Success
+ << componentResourceAfterInstall
+ << filesAfterInstall
+ << ":///data/installPackagesDependencyChanged"
+ << (QStringList() << "componentH")
+ << PackageManagerCore::Success
+ << componentResourcesAfterReinstall
+ << filesAfterReinstall
+ << deletedComponentResources;
+ }
+
+ void addToExistingInstall()
+ {
+ QFETCH(QString, repository);
+ QFETCH(QStringList, installComponents);
+ QFETCH(PackageManagerCore::Status, status);
+ QFETCH(ComponentResourceHash, componentResources);
+ QFETCH(QStringList, installedFiles);
+ QFETCH(QString, newRepository);
+ QFETCH(QStringList, installNewComponents);
+ QFETCH(PackageManagerCore::Status, reinstallStatus);
+ QFETCH(ComponentResourceHash, componentResourcesAfterReinstall);
+ QFETCH(QStringList, installedFilesAfterReinstall);
+ QFETCH(ComponentResourceHash, deletedComponentResources);
+
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, repository));
+ QCOMPARE(status, core->installSelectedComponentsSilently(installComponents));
+ QCOMPARE(status, core->status());
+
+ for (const ComponentResource &resource : componentResources)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFiles);
+
+ core->reset();
+ core->cancelMetaInfoJob(); //Call cancel to reset metadata so that update repositories are fetched
+
+ QSet<Repository> repoList;
+ Repository repo = Repository::fromUserInput(newRepository);
+ repoList.insert(repo);
+ core->settings().setDefaultRepositories(repoList);
+
+ QCOMPARE(reinstallStatus, core->installSelectedComponentsSilently(installNewComponents));
+
+ for (const ComponentResource &resource : deletedComponentResources)
+ VerifyInstaller::verifyInstallerResourceFileDeletion(m_installDir, resource.first, resource.second);
+ for (const ComponentResource &resource : componentResourcesAfterReinstall)
+ VerifyInstaller::verifyInstallerResources(m_installDir, resource.first, resource.second);
+ VerifyInstaller::verifyFileExistence(m_installDir, installedFilesAfterReinstall);
+ }
+
+ void testInstallDefaultPackagesSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ 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
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml" << "installcontent.txt"
+ << "installcontentA.txt" << "installcontentE.txt" << "installcontentG.txt");
+ }
+
+
+ void testNoDefaultInstallations()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ core->setNoDefaultInstallation(true);
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyFileExistence(m_installDir, QStringList() << "components.xml"
+ << "installcontentE.txt");
+ core->setNoDefaultInstallation(false);
+ }
+
+ void testRemoveAllSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ 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();
+ 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");
+
+ // On Windows we have to settle for the resources check above as maintenance
+ // tool (if it would exists) and target directory are only removed later via
+ // started VBScript process. On Unix platforms the target directory should
+ // be removed in PackageManagerCorePrivate::runUninstaller().
+#if defined(Q_OS_UNIX)
+ QVERIFY(!QDir(m_installDir).exists());
+#endif
+ }
+
+ void testUninstallVirtualSetVisibleSilently()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit
+ (m_installDir, ":///data/installPackagesRepository"));
+ core->setVirtualComponentsVisible(true);
+ 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();
+ QCOMPARE(PackageManagerCore::Success, core->uninstallComponentsSilently(QStringList()
+ << "componentH"));
+ QCOMPARE(PackageManagerCore::Success, core->status());
+ VerifyInstaller::verifyInstallerResourcesDeletion(m_installDir, "componentH");
+ }
+
+ void testFileQuery()
+ {
+ QScopedPointer<PackageManagerCore> core(PackageManager::getPackageManagerWithInit(m_installDir,
+ ":///data/filequeryrepository"));
+ core->setCommandLineInstance(true);
+ core->setFileDialogAutomaticAnswer("ValidDirectory", m_installDir);
+
+ QString testFile = qApp->applicationDirPath() + QDir::toNativeSeparators("/test");
+ QFile file(testFile);
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ core->setFileDialogAutomaticAnswer("ValidFile", testFile);
+
+ //File dialog launched without ID
+ core->setFileDialogAutomaticAnswer("GetExistingDirectory", m_installDir);
+ core->setFileDialogAutomaticAnswer("GetExistingFile", testFile);
+
+ QCOMPARE(PackageManagerCore::Success, core->installDefaultComponentsSilently());
+ QCOMPARE(PackageManagerCore::Success, core->status());
+
+ QVERIFY(core->containsFileDialogAutomaticAnswer("ValidFile"));
+ core->removeFileDialogAutomaticAnswer("ValidFile");
+ QVERIFY(!core->containsFileDialogAutomaticAnswer("ValidFile"));
+
+ QVERIFY(file.remove());
+ }
+
+ void init()
+ {
+ m_installDir = QInstaller::generateTemporaryFileName();
+ QVERIFY(QDir().mkpath(m_installDir));
+ }
+
+ void initTestCase()
+ {
+ qSetGlobalQHashSeed(0); //Ensures the dom document deterministic behavior
+ }
+
+ void cleanup()
+ {
+ QDir dir(m_installDir);
+ QVERIFY(dir.removeRecursively());
+ }
+
+private:
+ template <typename Func, typename... Args>
+ void verifyListPackagesMessage(PackageManagerCore *core, const QString &message,
+ Func func, Args... args)
+ {
+ std::ostringstream stream;
+ std::streambuf *buf = std::cout.rdbuf();
+ std::cout.rdbuf(stream.rdbuf());
+
+ (core->*func)(std::forward<Args>(args)...);
+
+ std::cout.rdbuf(buf);
+ QVERIFY(stream && stream.str() == message.toStdString());
+ }
+
+private:
+ QString m_installDir;
+};
+
+
+QTEST_MAIN(tst_CommandLineInstall)
+
+#include "tst_commandlineinstall.moc"
diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro
index eb5fa6d2e..5d93f2132 100644
--- a/tests/auto/installer/installer.pro
+++ b/tests/auto/installer/installer.pro
@@ -25,7 +25,7 @@ SUBDIRS += \
factory \
replaceoperation \
brokeninstaller \
- cliinterface \
+ commandlineinstall \
linereplaceoperation \
metadatajob \
appendfileoperation \