From e4f56db8d27983c3b89e905e7bac20609cdcc2b1 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Fri, 2 Feb 2024 13:53:05 +0000 Subject: [PATCH] Ensure default .geeqierc.xml is used in tests Set XDG_* for local tests so that local user file are not affected. --- scripts/image-test.sh | 11 +++++++++-- scripts/test-all.sh | 11 +++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/image-test.sh b/scripts/image-test.sh index 722eba7b..2f36cb32 100755 --- a/scripts/image-test.sh +++ b/scripts/image-test.sh @@ -29,8 +29,15 @@ xvfb-run --auto-servernum "$1" "$2" & +if [ -z "$XDG_CONFIG_HOME" ] +then + config_home="$HOME/.config" +else + config_home="$XDG_CONFIG_HOME" +fi + # Wait for remote to initialize -while [ ! -e "$HOME/.config/geeqie/.command" ] ; +while [ ! -e "$config_home/geeqie/.command" ] ; do sleep 1 done @@ -40,7 +47,7 @@ sleep 2 # Check if Geeqie crashed if ! pgrep geeqie then - rm "$HOME/.config/geeqie/.command" + rm "$config_home/geeqie/.command" exit 1 fi diff --git a/scripts/test-all.sh b/scripts/test-all.sh index 537dc573..666aecaa 100755 --- a/scripts/test-all.sh +++ b/scripts/test-all.sh @@ -32,6 +32,13 @@ then exit 1 fi +XDG_CONFIG_HOME=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +XDG_CACHE_HOME=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +XDG_DATA_HOME=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX") +export XDG_CONFIG_HOME +export XDG_CACHE_HOME +export XDG_DATA_HOME + rm --recursive --force build # Check with all options disabled @@ -74,3 +81,7 @@ meson setup -Ddevel=enabled build meson test -C build cp ./build/meson-logs/testlog.txt "$tmpdir/testlog-options-enabled.txt" + +rm -r "XDG_CONFIG_HOME" +rm -r "XDG_CACHE_HOME" +rm -r "XDG_DATA_HOME" -- 2.20.1