summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2021-05-12 11:00:02 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2021-05-17 10:00:33 +0200
commitd5daaa537da75766ff94281c866e0b739df92398 (patch)
tree99c1eb6ddb12bde2ede3062af05bd36e4ca818d9
parent087dfe663026a13649dec1198fbb90da65095d2f (diff)
downloadflatpak-d5daaa537da75766ff94281c866e0b739df92398.tar.gz
tests: Fix test-summaries.sh when running tests as root
If the tests are run as root, the system helper is not used even when commands are run with `--system`. This means a different cache path is used (see `_flatpak_dir_ensure_repo()`). The tests did not accommodate for that. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
-rw-r--r--tests/libtest.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 2c020667..eaefe5a2 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -117,7 +117,14 @@ if [ x${USE_SYSTEMDIR-} == xyes ] ; then
export FL_DIR=${SYSTEMDIR}
export U=
export INVERT_U=--user
- export FL_CACHE_DIR=${XDG_CACHE_HOME}/flatpak/system-cache
+ if [ x${UID} == x0 ] ; then
+ # If running as root (which happens on some build machines), the
+ # system-helper will not be used, and hence the fallback cache dir will
+ # be used in _flatpak_dir_ensure_repo().
+ export FL_CACHE_DIR=$FL_DIR/repo/tmp/cache
+ else
+ export FL_CACHE_DIR=${XDG_CACHE_HOME}/flatpak/system-cache
+ fi
else
export FL_DIR=${USERDIR}
export U="--user"