summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2020-07-14 19:24:36 +0900
committerAkira TAGOH <akira@tagoh.org>2020-07-14 19:48:11 +0900
commit437f03299bd1adc9673cd576072f1657be8fd4e0 (patch)
treef15bace7980d24de2b4ad904ad4ee3e84a4e6cee /test
parent4a1cf888cf94355f69cc31e2c219d1abe98327c2 (diff)
downloadfontconfig-437f03299bd1adc9673cd576072f1657be8fd4e0.tar.gz
Fix empty XDG_CACHE_HOME Behavior
Use the default $HOME/.cache one for empty XDG_CACHE_HOME. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/243
Diffstat (limited to 'test')
-rw-r--r--test/run-test.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/run-test.sh b/test/run-test.sh
index 1b5b7a7..267b54a 100644
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -423,4 +423,34 @@ else
echo "No test-crbug1004254: skipped"
fi
+if [ "x$EXEEXT" = "x" ]; then
+
+dotest "empty XDG_CACHE_HOME"
+prep
+export XDG_CACHE_HOME=""
+export old_HOME="$HOME"
+export temp_HOME=$(mktemp -d --tmpdir fontconfig.XXXXXXXX)
+export HOME="$temp_HOME"
+cp "$FONT1" "$FONT2" "$FONTDIR"
+if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then
+ touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"
+fi
+echo "<fontconfig><dir>$FONTDIR</dir><cachedir prefix=\"xdg\">fontconfig</cachedir></fontconfig>" > my-fonts.conf
+FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCCACHE "$FONTDIR" || :
+if [ -d "$HOME"/.cache ] && [ -d "$HOME"/.cache/fontconfig ]; then : ; else
+ echo "*** Test failed: $TEST"
+ echo "No \$HOME/.cache/fontconfig directory"
+ ls -a "$HOME"
+ ls -a "$HOME"/.cache
+ exit 1
+fi
+
+export HOME="$old_HOME"
+rm -rf "$temp_HOME" my-fonts.conf
+unset XDG_CACHE_HOME
+unset old_HOME
+unset temp_HOME
+
+fi # if [ "x$EXEEXT" = "x" ]
+
rm -rf "$FONTDIR" "$CACHEFILE" "$CACHEDIR" "$BASEDIR" "$FONTCONFIG_FILE" out