Make the messages clearer

This commit is contained in:
Ben Jackson 2020-07-12 20:12:31 +01:00
commit 231720b5b5
2 changed files with 34 additions and 5 deletions

View file

@ -58,11 +58,10 @@ stages:
- bash: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
export GOPATH=$HOME/go
./run_tests
./run_tests --report messages --quiet
displayName: 'Run the tests'
env:
VIMSPECTOR_MIMODE: gdb
VIMSPECTOR_TEST_STDOUT: messsages
- bash: ./make_package linux $(Build.SourceVersion)
displayName: 'Package'
@ -103,11 +102,10 @@ stages:
- bash: vim --version
displayName: 'Print vim version information'
- bash: ./run_tests
- bash: ./run_tests --report messages --quiet
displayName: 'Run the tests'
env:
VIMSPECTOR_MIMODE: lldb
VIMSPECTOR_TEST_STDOUT: messsages
- bash: ./make_package macos $(Build.SourceVersion)
displayName: 'Package'

View file

@ -5,7 +5,8 @@ if [ "$1" == "--help" ]; then
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 " --report <messages|all> how verbose to be with stdout"
echo " --report <messages|all> which logs to dump to stdout after a test"
echo " --quiet suppress vim's stdout"
echo "e.g.: "
echo " - run all tests: $0"
echo " - run specific tests script: $0 signature_help.test.vim"
@ -21,6 +22,9 @@ RUN_VIM="vim -N --clean --not-a-term"
RUN_TEST="${RUN_VIM} -S lib/run_test.vim"
BASEDIR_CMD='py3 pass'
# 1 is stdout
out_fd=1
while [ -n "$1" ]; do
case "$1" in
"--basedir")
@ -42,6 +46,15 @@ while [ -n "$1" ]; do
VIMSPECTOR_TEST_STDOUT=$1
shift
;;
"--quiet")
shift
# send the output to /dev/null
# https://stackoverflow.com/a/47553900
# Note we can't use {out_fd} here because the bash version in CI is too
# old on macOS
out_fd=3
exec 3>/dev/null
;;
"--")
shift
break
@ -52,6 +65,13 @@ while [ -n "$1" ]; do
esac
done
# We use fd 3 for vim's output. Send it to stdout if not already redirected
# Note: can't use ${out_fd} in a redirect because redirects happen before
# variable substitution
if [ "${out_fd}" = "1" ]; then
exec 3>&1
fi
if [ $INSTALL = 1 ]; then
python3 $(dirname $0)/install_gadget.py --basedir ${BASEDIR} --all
fi
@ -105,6 +125,7 @@ for t in ${TESTS}; do
if ${RUN_TEST} --cmd "${BASEDIR_CMD}" \
--cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \
>&3\
&& [ -f $t.res ]; then
echo "%PASS: $t PASSED"
else
@ -117,7 +138,13 @@ for t in ${TESTS}; do
${RUN_VIM} --version > ${TESTLOGDIR}/vimversion
if [ "$VIMSPECTOR_TEST_STDOUT" = "messages" ]; then
if [ -f messages ]; then
echo "%MESSAGES"
cat messages
echo "%END"
else
echo "%MESSAGES"
echo "No messages found"
echo "%END"
fi
fi
@ -138,6 +165,10 @@ for t in ${TESTS}; do
rm -f $t.res
done
# close out_fd if it's not stdout/stderr/
(( out_fd > 2 )) && exec 3>&-
echo "Done running tests"
popd > /dev/null