summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2021-10-21 18:38:29 +0100
committerAlexander Larsson <alexander.larsson@gmail.com>2021-11-15 11:07:57 +0100
commita3464bebb7d87537aeed26fa8f535c077ab124db (patch)
treef6cce640fa659a3b263e32b53c0713fb70ddde67
parent3acdb37fc692687762509a45281e4faf27e8374a (diff)
downloadflatpak-a3464bebb7d87537aeed26fa8f535c077ab124db.tar.gz
tests: Check that we handle XDG_foo_HOME as intended
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--tests/test-run.sh36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/test-run.sh b/tests/test-run.sh
index 4f785f9d..6e84a507 100644
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -24,7 +24,7 @@ set -euo pipefail
skip_without_bwrap
skip_revokefs_without_fuse
-echo "1..19"
+echo "1..20"
# Use stable rather than master as the branch so we can test that the run
# command automatically finds the branch correctly
@@ -83,6 +83,40 @@ assert_file_has_content value-in-sandbox "^/run/user/$(id -u)\$"
ok "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR not inherited"
+assert_streq "$XDG_CACHE_HOME" "${TEST_DATA_DIR}/home/cache"
+run_sh org.test.Hello 'echo "$XDG_CACHE_HOME"' > value-in-sandbox
+head value-in-sandbox >&2
+assert_file_has_content value-in-sandbox "^${TEST_DATA_DIR}/home/\\.var/app/org\\.test\\.Hello/cache\$"
+run_sh org.test.Hello 'echo "$HOST_XDG_CACHE_HOME"' > host-value-in-sandbox
+head host-value-in-sandbox >&2
+assert_file_has_content host-value-in-sandbox "^${TEST_DATA_DIR}/home/cache\$"
+
+assert_streq "$XDG_CONFIG_HOME" "${TEST_DATA_DIR}/home/config"
+run_sh org.test.Hello 'echo "$XDG_CONFIG_HOME"' > value-in-sandbox
+head value-in-sandbox >&2
+assert_file_has_content value-in-sandbox "^${TEST_DATA_DIR}/home/\\.var/app/org\\.test\\.Hello/config\$"
+run_sh org.test.Hello 'echo "$HOST_XDG_CONFIG_HOME"' > host-value-in-sandbox
+head host-value-in-sandbox >&2
+assert_file_has_content host-value-in-sandbox "^${TEST_DATA_DIR}/home/config\$"
+
+assert_streq "$XDG_DATA_HOME" "${TEST_DATA_DIR}/home/share"
+run_sh org.test.Hello 'echo "$XDG_DATA_HOME"' > value-in-sandbox
+head value-in-sandbox >&2
+assert_file_has_content value-in-sandbox "^${TEST_DATA_DIR}/home/\\.var/app/org\\.test\\.Hello/data\$"
+run_sh org.test.Hello 'echo "$HOST_XDG_DATA_HOME"' > host-value-in-sandbox
+head host-value-in-sandbox >&2
+assert_file_has_content host-value-in-sandbox "^${TEST_DATA_DIR}/home/share\$"
+
+assert_streq "$XDG_STATE_HOME" "${TEST_DATA_DIR}/home/state"
+run_sh org.test.Hello 'echo "$XDG_STATE_HOME"' > value-in-sandbox
+head value-in-sandbox >&2
+assert_file_has_content value-in-sandbox "^${TEST_DATA_DIR}/home/\\.var/app/org\\.test\\.Hello/\\.local/state\$"
+run_sh org.test.Hello 'echo "$HOST_XDG_STATE_HOME"' > host-value-in-sandbox
+head host-value-in-sandbox >&2
+assert_file_has_content host-value-in-sandbox "^${TEST_DATA_DIR}/home/state\$"
+
+ok "XDG_foo_HOME work as expected"
+
run_sh org.test.Platform cat /.flatpak-info >runtime-fpi
assert_file_has_content runtime-fpi "[Runtime]"
assert_file_has_content runtime-fpi "^runtime=runtime/org\.test\.Platform/$ARCH/stable$"