diff --git a/tests/libtest.sh b/tests/libtest.sh index 592d16c4f..fd96cfd21 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -136,13 +136,16 @@ if [ x${USE_SYSTEMDIR-} == xyes ] ; then export FL_DIR=${SYSTEMDIR} export U= export INVERT_U=--user - 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 + if [ x${HAVE_SYSTEM_HELPER-} == x1 ] && [ x${UID} != x0 ] ; then + # If system helper is compiled during build and will actually be + # used at runtime eg. UID != 0, Flatpak stores summary caches + # in the user's XDG cache directory export FL_CACHE_DIR=${XDG_CACHE_HOME}/flatpak/system-cache + else + # If the system helper is unavailable at build time, or it + # cannot be used eg. UID == 0 Flatpak uses the repo-local cache + # directory. + export FL_CACHE_DIR=$FL_DIR/repo/tmp/cache fi else export FL_DIR=${USERDIR} diff --git a/tests/meson.build b/tests/meson.build index a0942df37..53f8656de 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -31,6 +31,7 @@ tests_environment = { 'FLATPAK_BWRAP' : env_flatpak_bwrap, 'FLATPAK_DBUSPROXY' : env_flatpak_dbusproxy, 'HAVE_SECCOMP' : libseccomp_dep.found() ? '1' : '0', + 'HAVE_SYSTEM_HELPER' : build_system_helper ? '1' : '0', } tests_environment_prepend = {