1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
SUITE_upgrade_PROBE() {
if ! $RUN_WIN_XFAIL; then
echo "upgrade tests are broken on Windows. (mix between windows and posix path)"
return
fi
}
SUITE_upgrade() {
# -------------------------------------------------------------------------
TEST "Default cache config/directory without XDG variables"
unset CCACHE_CONFIGPATH
unset CCACHE_DIR
export HOME=/home/user
if $HOST_OS_APPLE; then
expected=$HOME/Library/Caches/ccache
else
expected=$HOME/.cache/ccache
fi
actual=$($CCACHE -k cache_dir)
if [ "$actual" != "$expected" ]; then
test_failed "expected cache directory $expected, actual $actual"
fi
if $HOST_OS_APPLE; then
expected=$HOME/Library/Preferences/ccache/ccache.conf
else
expected=$HOME/.config/ccache/ccache.conf
fi
actual=$($CCACHE -sv | sed -n 's/^Config file: *//p')
if [ "$actual" != "$expected" ]; then
test_failed "expected config $expected, actual $actual"
fi
# -------------------------------------------------------------------------
TEST "Default cache config/directory with XDG variables"
unset CCACHE_CONFIGPATH
unset CCACHE_DIR
export HOME=$PWD
export XDG_CACHE_HOME=/somewhere/cache
export XDG_CONFIG_HOME=/elsewhere/config
expected=$XDG_CACHE_HOME/ccache
actual=$($CCACHE -k cache_dir)
if [ "$actual" != "$expected" ]; then
test_failed "expected cache directory $expected, actual $actual"
fi
expected=$XDG_CONFIG_HOME/ccache/ccache.conf
actual=$($CCACHE -sv | sed -n 's/^Config file: *//p')
if [ "$actual" != "$expected" ]; then
test_failed "expected config $expected, actual $actual"
fi
# -------------------------------------------------------------------------
TEST "Cache config/directory with XDG variables and legacy directory"
unset CCACHE_CONFIGPATH
unset CCACHE_DIR
export HOME=$PWD
export XDG_CACHE_HOME=/somewhere/cache
export XDG_CONFIG_HOME=/elsewhere/config
mkdir $HOME/.ccache
expected=$HOME/.ccache
actual=$($CCACHE -k cache_dir)
if [ "$actual" != "$expected" ]; then
test_failed "expected cache directory $expected, actual $actual"
fi
expected=$HOME/.ccache/ccache.conf
actual=$($CCACHE -sv | sed -n 's/^Config file: *//p')
if [ "$actual" != "$expected" ]; then
test_failed "expected config $expected, actual $actual"
fi
# -------------------------------------------------------------------------
TEST "Cache config/directory with XDG variables and CCACHE_DIR"
unset CCACHE_CONFIGPATH
export CCACHE_DIR=$PWD/test
export HOME=/home/user
export XDG_CACHE_HOME=/somewhere/cache
export XDG_CONFIG_HOME=/elsewhere/config
expected=$CCACHE_DIR
actual=$($CCACHE -k cache_dir)
if [ "$actual" != "$expected" ]; then
test_failed "expected cache directory $expected, actual $actual"
fi
expected=$CCACHE_DIR/ccache.conf
actual=$($CCACHE -sv | sed -n 's/^Config file: *//p')
if [ "$actual" != "$expected" ]; then
test_failed "expected config $expected, actual $actual"
fi
# -------------------------------------------------------------------------
TEST "Cache config/directory with empty CCACHE_DIR"
# Empty (but set) CCACHE_DIR means "use defaults" and should thus override
# cache_dir set in the system config.
unset CCACHE_CONFIGPATH
export CCACHE_CONFIGPATH2=$PWD/ccache.conf2
export HOME=/home/user
export XDG_CACHE_HOME=/somewhere/cache
export XDG_CONFIG_HOME=/elsewhere/config
export CCACHE_DIR= # Set but empty
echo 'cache_dir = /nowhere' > $CCACHE_CONFIGPATH2
expected=$XDG_CACHE_HOME/ccache
actual=$($CCACHE -k cache_dir)
if [ "$actual" != "$expected" ]; then
test_failed "expected cache directory $expected, actual $actual"
fi
expected=$XDG_CONFIG_HOME/ccache/ccache.conf
actual=$($CCACHE -sv | sed -n 's/^Config file: *//p')
if [ "$actual" != "$expected" ]; then
test_failed "expected config $expected, actual $actual"
fi
}
|