Allow moving the gadget/configuration dirs to arbitrary location

This commit is contained in:
Ben Jackson 2020-05-09 15:22:42 +01:00
commit 5837135fee
6 changed files with 106 additions and 14 deletions

View file

@ -1,16 +1,54 @@
#!/usr/bin/env bash
if [ "$1" == "--help" ]; then
echo "$(basename $0) <optional list of tests in form file:func>"
echo "$(basename $0) [--basedir <basedir>] [--install] <optional list of tests in form file:func>"
echo ""
echo " --basedir <basedir> path to runtime directory like the optino to install_gadget.py"
echo " --install run install_gadget.py, useful with --basedir"
echo "e.g.: "
echo " - run all tests: $0"
echo " - run specific tests script: $0 signature_help.test.vim"
echo " - run specific tests fun: $0 signature_help.test.vim:Test_signatures_TopLine\(\)"
echo " - run all tests in a clean env: $0 --basedir \$(mktemp -d) --install"
exit 0
fi
RUN_VIM="vim --clean --not-a-term"
BASEDIR=$(dirname $0)
INSTALL=0
RUN_VIM="vim -N --clean --not-a-term"
RUN_TEST="${RUN_VIM} -S lib/run_test.vim"
BASEDIR_CMD='py3 pass'
while [ -n "$1" ]; do
case "$1" in
"--basedir")
BASEDIR=$2
if [[ ! $BASEDIR = /* ]]; then
# Relative
BASEDIR=$(pwd)/${BASEDIR}
fi
BASEDIR_CMD="let g:vimspector_base_dir='${BASEDIR}'"
shift
shift
;;
"--install")
INSTALL=1
shift
;;
"--")
shift
break
;;
*)
break
;;
esac
done
if [ $INSTALL = 1 ]; then
python3 $(dirname $0)/install_gadget.py --basedir ${BASEDIR} --all
fi
if [ -z "$VIMSPECTOR_MIMODE" ]; then
if which lldb >/dev/null 2>&1; then
@ -25,6 +63,10 @@ fi
echo "Testing with:"
echo " * VIMSPECTOR_MIMODE=$VIMSPECTOR_MIMODE"
echo " * RUN_VIM=$RUN_VIM"
echo " * RUN_TEST=$RUN_TEST"
echo " * BASEDIR_CMD=$BASEDIR_CMD"
echo "%SETUP - Building test programs..."
set -e
@ -53,9 +95,10 @@ for t in ${TESTS}; do
# split on : into fileName and testName
IFS=: read -s t T <<< "$t"
TESTLOGDIR=$(pwd)/logs/$t
TESTLOGDIR=${BASEDIR}/tests/logs/$t
if ${RUN_TEST} --cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \
if ${RUN_TEST} --cmd "${BASEDIR_CMD}" \
--cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \
&& [ -f $t.res ]; then
echo "%PASS: $t PASSED"
else