diff options
author | Robert Griebl <robert.griebl@qt.io> | 2024-05-14 12:16:07 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2024-05-15 12:36:16 +0200 |
commit | 09903c46b74ba8e8aee71340993ab7849ef8f830 (patch) | |
tree | 02c3a7d07fa329bbf677bc968fe316bc016597c0 /tests/auto | |
parent | d808d85013ad21b969e3b6e545986716772b5fc5 (diff) |
Remove all literal uses of /tmp
- In am-configs, use QStandardPaths to avoid creating a mess in the
filesystem on Windows.
- In the C++ code, we really should be using $XDG_RUNTIME_DIR on
Linux nowadays.
While at it, the /tmp (and /run) subdirectories used by the appman
have been harmonized and made less cryptic.
Change-Id: Iab71aff81333653fb12bcecd3e94767b64f2c818
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controller-tool/am-config.yaml | 4 | ||||
-rw-r--r-- | tests/auto/controller-tool/tst_controller-tool.cpp | 4 | ||||
-rw-r--r-- | tests/auto/main/am-config.yaml | 4 | ||||
-rw-r--r-- | tests/auto/main/tst_main.cpp | 20 | ||||
-rw-r--r-- | tests/auto/qml/active/am-config.yaml | 4 | ||||
-rw-r--r-- | tests/auto/qml/installer/am-config.yaml | 4 | ||||
-rw-r--r-- | tests/auto/qml/keyinput/am-config.yaml | 4 | ||||
-rw-r--r-- | tests/auto/qml/resources/am-config.yaml | 2 | ||||
-rw-r--r-- | tests/auto/qml/windowitem/am-config.yaml | 4 |
9 files changed, 27 insertions, 23 deletions
diff --git a/tests/auto/controller-tool/am-config.yaml b/tests/auto/controller-tool/am-config.yaml index fe61a890..350be81a 100644 --- a/tests/auto/controller-tool/am-config.yaml +++ b/tests/auto/controller-tool/am-config.yaml @@ -3,8 +3,8 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/builtin-apps" - installationDir: "/tmp/am-test-controller-tool/apps" - documentDir: "/tmp/am-test-controller-tool/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/controller-tool/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/controller-tool/docs" ui: mainQml: "${CONFIG_PWD}/system-ui.qml" diff --git a/tests/auto/controller-tool/tst_controller-tool.cpp b/tests/auto/controller-tool/tst_controller-tool.cpp index 5150844b..53b8e835 100644 --- a/tests/auto/controller-tool/tst_controller-tool.cpp +++ b/tests/auto/controller-tool/tst_controller-tool.cpp @@ -322,7 +322,9 @@ void tst_ControllerTool::installationLocations() QCOMPARE(docs.size(), 1); const auto vm = docs[0].toMap(); - QCOMPARE(vm.value(u"path"_s), u"/tmp/am-test-controller-tool/apps"_s); + QDir appsDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)); + QCOMPARE(vm.value(u"path"_s), appsDir.absoluteFilePath(u"qtam-test/controller-tool/apps"_s)); + QVERIFY(vm.value(u"deviceSize"_s).toULongLong() > 0); QVERIFY(vm.value(u"deviceFree"_s).toULongLong() > 0); } diff --git a/tests/auto/main/am-config.yaml b/tests/auto/main/am-config.yaml index ff538f1b..6fdc0349 100644 --- a/tests/auto/main/am-config.yaml +++ b/tests/auto/main/am-config.yaml @@ -3,8 +3,8 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/builtin-apps" - installationDir: "/tmp/am-test-main/apps" - documentDir: "/tmp/am-test-main/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/main/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/main/docs" ui: mainQml: "${CONFIG_PWD}/dummy.qml" diff --git a/tests/auto/main/tst_main.cpp b/tests/auto/main/tst_main.cpp index 1b11e06d..11afee0a 100644 --- a/tests/auto/main/tst_main.cpp +++ b/tests/auto/main/tst_main.cpp @@ -57,11 +57,16 @@ private: Configuration *config = nullptr; bool m_verbose = false; int m_spyTimeout; + QString m_tempDirPath; }; tst_Main::tst_Main() : m_spyTimeout(5000 * timeoutFactor()) -{ } +{ + // this needs to be the same path as in am-config.yaml + m_tempDirPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + + u"/qtam-test/main"_s; +} tst_Main::~tst_Main() { } @@ -93,13 +98,10 @@ void tst_Main::copyRecursively(const QString &sourcePath, const QString &destPat void tst_Main::cleanUpInstallationDir() { - { - QDir testTmpDir(u"/tmp/am-test-main"_s); - if (testTmpDir.exists()) - testTmpDir.removeRecursively(); - } - QDir tmpDir(u"/tmp"_s); - tmpDir.mkdir(u"am-test-main"_s); + QDir tempDir(m_tempDirPath); + if (tempDir.exists()) + tempDir.removeRecursively(); + tempDir.mkpath(u"."_s); } void tst_Main::init() @@ -265,7 +267,7 @@ void tst_Main::installAndRemoveUpdateForBuiltIn() */ void tst_Main::updateForBuiltInAlreadyInstalled() { - copyRecursively(QFINDTESTDATA("dir-with-update-already-installed"), u"/tmp/am-test-main"_s); + copyRecursively(QFINDTESTDATA("dir-with-update-already-installed"), m_tempDirPath); initMain(); diff --git a/tests/auto/qml/active/am-config.yaml b/tests/auto/qml/active/am-config.yaml index 1aa8648a..90d4f2c8 100644 --- a/tests/auto/qml/active/am-config.yaml +++ b/tests/auto/qml/active/am-config.yaml @@ -3,5 +3,5 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installationDir: "/tmp/am/apps" - documentDir: "/tmp/am/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/active/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/active/docs" diff --git a/tests/auto/qml/installer/am-config.yaml b/tests/auto/qml/installer/am-config.yaml index d0e12789..a329793f 100644 --- a/tests/auto/qml/installer/am-config.yaml +++ b/tests/auto/qml/installer/am-config.yaml @@ -3,8 +3,8 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installationDir: "/tmp/am-installer-test/apps" - documentDir: "/tmp/am-installer-test/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/installer/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/installer/docs" flags: noSecurity: yes diff --git a/tests/auto/qml/keyinput/am-config.yaml b/tests/auto/qml/keyinput/am-config.yaml index 1aa8648a..4f7a342b 100644 --- a/tests/auto/qml/keyinput/am-config.yaml +++ b/tests/auto/qml/keyinput/am-config.yaml @@ -3,5 +3,5 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installationDir: "/tmp/am/apps" - documentDir: "/tmp/am/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/keyinput/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/keyinput/docs" diff --git a/tests/auto/qml/resources/am-config.yaml b/tests/auto/qml/resources/am-config.yaml index a06cb076..7db6dc8b 100644 --- a/tests/auto/qml/resources/am-config.yaml +++ b/tests/auto/qml/resources/am-config.yaml @@ -3,7 +3,7 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installationDir: "/tmp/am-resource-test/apps" + installationDir: "${stdpath:TempLocation}/qtam-test/resources/apps" quicklaunch: runtimesPerContainer: 1 diff --git a/tests/auto/qml/windowitem/am-config.yaml b/tests/auto/qml/windowitem/am-config.yaml index aa82540b..ede1e91f 100644 --- a/tests/auto/qml/windowitem/am-config.yaml +++ b/tests/auto/qml/windowitem/am-config.yaml @@ -3,8 +3,8 @@ formatType: am-configuration --- applications: builtinAppsManifestDir: "${CONFIG_PWD}/apps" - installationDir: "/tmp/am/apps" - documentDir: "/tmp/am/docs" + installationDir: "${stdpath:TempLocation}/qtam-test/windowitem/apps" + documentDir: "${stdpath:TempLocation}/qtam-test/windowitem/docs" # Workaround for a crash in the mesa software renderer (llvmpipe) runtimes: |