Do not use readlink(1) in tests
Avoid using readlink(1) which is not POSIX-compatible; moreover, `readlink -f` is not available on Mac OS by default. Instead, always convert $CALCURSE to an absolute path (that may or may not be canonical, i.e., be a symlink or contain ../ as component) in test-init.sh by prepending the current working directory if the original path is relative. While not fully equivalent to `readlink -f`, this should be good enough for use in our tests. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
f1e84bd18b
commit
b36e603997
@ -3,7 +3,6 @@
|
|||||||
. "${TEST_INIT:-./test-init.sh}"
|
. "${TEST_INIT:-./test-init.sh}"
|
||||||
home=$(mktemp -d)
|
home=$(mktemp -d)
|
||||||
|
|
||||||
CALCURSE=$(readlink -f "$CALCURSE")
|
|
||||||
(unset -v XDG_DATA_HOME XDG_CONFIG_HOME; HOME="$home" "$CALCURSE" -a)
|
(unset -v XDG_DATA_HOME XDG_CONFIG_HOME; HOME="$home" "$CALCURSE" -a)
|
||||||
[ -f "$home/.local/share/calcurse/apts" ] && [ -f "$home/.config/calcurse/conf" ] && failed=0 || failed=1
|
[ -f "$home/.local/share/calcurse/apts" ] && [ -f "$home/.config/calcurse/conf" ] && failed=0 || failed=1
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
. "${TEST_INIT:-./test-init.sh}"
|
. "${TEST_INIT:-./test-init.sh}"
|
||||||
dir=$(mktemp -d)
|
dir=$(mktemp -d)
|
||||||
|
|
||||||
CALCURSE=$(readlink -f "$CALCURSE")
|
|
||||||
cd "$dir"
|
cd "$dir"
|
||||||
(unset -v HOME XDG_DATA_HOME XDG_CONFIG_HOME; "$CALCURSE" -a)
|
(unset -v HOME XDG_DATA_HOME XDG_CONFIG_HOME; "$CALCURSE" -a)
|
||||||
[ -f "$dir/.calcurse/apts" ] && [ -f "$dir/.calcurse/conf" ] && failed=0 || failed=1
|
[ -f "$dir/.calcurse/apts" ] && [ -f "$dir/.calcurse/conf" ] && failed=0 || failed=1
|
||||||
|
@ -2,3 +2,8 @@
|
|||||||
|
|
||||||
CALCURSE=${CALCURSE:-../src/calcurse}
|
CALCURSE=${CALCURSE:-../src/calcurse}
|
||||||
DATA_DIR=${DATA_DIR:-data/}
|
DATA_DIR=${DATA_DIR:-data/}
|
||||||
|
|
||||||
|
case "$CALCURSE" in
|
||||||
|
/*) ;;
|
||||||
|
*) CALCURSE="${PWD}/${CALCURSE}" ;;
|
||||||
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user