summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDominik Holland <[email protected]>2025-07-07 13:52:39 +0200
committerRobert Griebl <[email protected]>2025-07-11 19:48:37 +0200
commit4b4b79fe02da64c65279ee81f7225b4f509ff4f7 (patch)
treebb5867e6807401e8e134abeee6580c463246ee2b /tests/auto
parent5dd4a58fc05e41a219f840957838092f0fc6005b (diff)
Write the installation-report into its own folderHEADdev
Change-Id: Ie31346041346cae368c9ce29977ed321e64d7cdc Reviewed-by: Robert Griebl <[email protected]>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/main/tst_main.cpp15
-rw-r--r--tests/auto/packagemanager/tst_packagemanager.cpp7
-rw-r--r--tests/auto/packager-tool/tst_packager-tool.cpp7
3 files changed, 25 insertions, 4 deletions
diff --git a/tests/auto/main/tst_main.cpp b/tests/auto/main/tst_main.cpp
index 49b67e77..0a1812f1 100644
--- a/tests/auto/main/tst_main.cpp
+++ b/tests/auto/main/tst_main.cpp
@@ -50,6 +50,7 @@ private:
void initMain(const QString &mainQml = { });
void destroyMain();
void copyRecursively(const QString &sourceDir, const QString &destDir);
+ void fixupInstallationReport(const QString &baseDir, const QString &appDir);
int argc = 0;
char **argv = nullptr;
Main *main = nullptr;
@@ -96,6 +97,19 @@ void tst_Main::copyRecursively(const QString &sourcePath, const QString &destPat
QFile::copy(sourceDir.filePath(fileName), destDir.filePath(fileName));
}
+void tst_Main::fixupInstallationReport(const QString &baseDir, const QString &appDir)
+{
+ QString src = baseDir + u'/' + appDir + u"/.installation-report.yaml"_s;
+ if (QFile::exists(src)) {
+ QString dataDir = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
+ QString dst = dataDir + u"/installation-reports/"_s + appDir.section(u'/', -1, 1) + u".yaml"_s;
+
+ if (QFile::exists(dst))
+ QFile::remove(dst);
+ QFile::rename(src, dst);
+ }
+}
+
void tst_Main::cleanUpInstallationDir()
{
QDir tempDir(m_tempDirPath);
@@ -271,6 +285,7 @@ void tst_Main::installAndRemoveUpdateForBuiltIn()
void tst_Main::updateForBuiltInAlreadyInstalled()
{
copyRecursively(QFINDTESTDATA("dir-with-update-already-installed"), m_tempDirPath);
+ fixupInstallationReport(m_tempDirPath, u"apps/test-pkg"_s);
initMain();
diff --git a/tests/auto/packagemanager/tst_packagemanager.cpp b/tests/auto/packagemanager/tst_packagemanager.cpp
index b1167928..426ad4c5 100644
--- a/tests/auto/packagemanager/tst_packagemanager.cpp
+++ b/tests/auto/packagemanager/tst_packagemanager.cpp
@@ -433,6 +433,9 @@ void tst_PackageManager::packageInstallation()
: (devSigned ? AllowInstallations::RequireDevSigned
: AllowInstallations::AllowUnsigned));
+ QDir dataDir = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
+ QString instReport = dataDir.absoluteFilePath(u"installation-reports/test-pkg.yaml"_s);
+
int lastPass = (updatePackageName.isEmpty() ? 1 : 2);
// pass 1 is the installation / pass 2 is the update (if needed)
for (int pass = 1; pass <= lastPass; ++pass) {
@@ -471,7 +474,7 @@ void tst_PackageManager::packageInstallation()
//QDirIterator it(m_workDir.path(), QDirIterator::Subdirectories);
//while (it.hasNext()) { qDebug() << it.next(); }
- QVERIFY(QFile::exists(installationDir + u"/test-pkg/.installation-report.yaml"_s));
+ QVERIFY(QFile::exists(instReport));
QVERIFY(QDir(documentDir + u"/test-pkg"_s).exists());
QString fileCheckPath = installationDir + u"/test-pkg"_s;
@@ -556,7 +559,7 @@ void tst_PackageManager::simulateErrorConditions_data()
#ifdef Q_OS_LINUX
QTest::newRow("applications-dir-read-only") \
- << false << "~could not create installation directory .*" \
+ << false << "~could not create a temporary extraction directory .*" \
<< FunctionMap { { "before-start", [this]() { return chmod(pathTo(Internal0).toLocal8Bit(), 0000) == 0; } },
{ "after-failed", [this]() { return chmod(pathTo(Internal0).toLocal8Bit(), 0777) == 0; } } };
diff --git a/tests/auto/packager-tool/tst_packager-tool.cpp b/tests/auto/packager-tool/tst_packager-tool.cpp
index 6cb7d4a9..5d6f7470 100644
--- a/tests/auto/packager-tool/tst_packager-tool.cpp
+++ b/tests/auto/packager-tool/tst_packager-tool.cpp
@@ -17,6 +17,7 @@
#include "qmlinprocruntime.h"
#include "runtimefactory.h"
#include "utilities.h"
+#include "sudo.h"
#include "../error-checking.h"
@@ -32,7 +33,7 @@ class tst_PackagerTool : public QObject
private Q_SLOTS:
void initTestCase();
- void cleanup();
+ void cleanupTestCase();
void test();
void brokenMetadata_data();
@@ -68,6 +69,8 @@ void tst_PackagerTool::initTestCase()
if (!QDir(QString::fromLatin1(AM_TESTDATA_DIR "/packages")).exists())
QSKIP("No test packages available in the data/ directory");
+ Sudo::fallbackServer();
+
spyTimeout *= timeoutFactor();
QVERIFY(m_workDir.isValid());
@@ -112,7 +115,7 @@ void tst_PackagerTool::initTestCase()
RuntimeFactory::instance()->registerRuntime(new QmlInProcRuntimeManager(u"qml"_s));
}
-void tst_PackagerTool::cleanup()
+void tst_PackagerTool::cleanupTestCase()
{
recursiveOperation(pathTo("internal-0"), safeRemove);
recursiveOperation(pathTo("documents-0"), safeRemove);