Tests: Import test framework changs from YCM
This commit is contained in:
parent
149d48b688
commit
6ee8f7875d
3 changed files with 44 additions and 7 deletions
49
run_tests
49
run_tests
|
|
@ -1,8 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$1" == "--help" ]; then
|
||||
echo "$(basename $0) <optional list of tests in form file:func>"
|
||||
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\(\)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RUN_VIM="vim --clean --not-a-term"
|
||||
RUN_TEST="${RUN_VIM} -S lib/run_test.vim"
|
||||
|
||||
if [ $(node --version | awk 'BEGIN { FS="." } { print $1 }') != "v10" ]; then
|
||||
echo "ERROR: Tests must be run against node v10 because python." >&2
|
||||
echo "You have $(node --version)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$VIMSPECTOR_MIMODE" ]; then
|
||||
if which lldb >/dev/null 2>&1; then
|
||||
export VIMSPECTOR_MIMODE=lldb
|
||||
|
|
@ -24,8 +39,8 @@ set -e
|
|||
set +e
|
||||
echo "%DONE - built test programs"
|
||||
|
||||
pushd tests > /dev/null
|
||||
|
||||
# Start
|
||||
pushd $(dirname $0)/tests > /dev/null
|
||||
echo "Running Vimspector Vim tests"
|
||||
|
||||
RESULT=0
|
||||
|
|
@ -39,23 +54,45 @@ fi
|
|||
for t in ${TESTS}; do
|
||||
echo ""
|
||||
echo "%RUN: $t"
|
||||
rm -f messages debuglog
|
||||
|
||||
# split on : into fileName and testName
|
||||
IFS=: read -s t T <<< "$t"
|
||||
|
||||
if ${RUN_TEST} --cmd 'au SwapExists * let v:swapchoice = "e"' $t $T; then
|
||||
TESTLOGDIR=$(pwd)/logs/$t
|
||||
|
||||
if ${RUN_TEST} --cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \
|
||||
&& [ -f $t.res ]; then
|
||||
echo "%PASS: $t PASSED"
|
||||
else
|
||||
cat messages
|
||||
echo "%FAIL: $t FAILED"
|
||||
echo "%FAIL: $t FAILED - see $TESTLOGDIR"
|
||||
RESULT=1
|
||||
fi
|
||||
|
||||
rm -rf $TESTLOGDIR
|
||||
mkdir -p $TESTLOGDIR
|
||||
${RUN_VIM} --version > ${TESTLOGDIR}/vimversion
|
||||
for l in messages debuglog *.log; do
|
||||
# In CI we can't view the output files, so we just have to cat them
|
||||
if [ -f $l ]; then
|
||||
if [ "$VIMSPECTOR_TEST_STDOUT" ]; then
|
||||
echo ""
|
||||
echo ""
|
||||
echo "*** START: $l ***"
|
||||
cat $l
|
||||
echo "*** END: $l ***"
|
||||
fi
|
||||
mv $l $TESTLOGDIR
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f $t.res
|
||||
done
|
||||
|
||||
echo "Done running tests"
|
||||
popd > /dev/null
|
||||
|
||||
echo ""
|
||||
echo "All done."
|
||||
|
||||
|
||||
exit $RESULT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue