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

View file

@ -5,7 +5,8 @@ if [ "$1" == "--help" ]; then
echo "" echo ""
echo " --basedir <basedir> path to runtime directory like the optino to install_gadget.py" echo " --basedir <basedir> path to runtime directory like the optino to install_gadget.py"
echo " --install run install_gadget.py, useful with --basedir" 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 "e.g.: "
echo " - run all tests: $0" echo " - run all tests: $0"
echo " - run specific tests script: $0 signature_help.test.vim" 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" RUN_TEST="${RUN_VIM} -S lib/run_test.vim"
BASEDIR_CMD='py3 pass' BASEDIR_CMD='py3 pass'
# 1 is stdout
out_fd=1
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
"--basedir") "--basedir")
@ -42,6 +46,15 @@ while [ -n "$1" ]; do
VIMSPECTOR_TEST_STDOUT=$1 VIMSPECTOR_TEST_STDOUT=$1
shift 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 shift
break break
@ -52,6 +65,13 @@ while [ -n "$1" ]; do
esac esac
done 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 if [ $INSTALL = 1 ]; then
python3 $(dirname $0)/install_gadget.py --basedir ${BASEDIR} --all python3 $(dirname $0)/install_gadget.py --basedir ${BASEDIR} --all
fi fi
@ -105,6 +125,7 @@ for t in ${TESTS}; do
if ${RUN_TEST} --cmd "${BASEDIR_CMD}" \ if ${RUN_TEST} --cmd "${BASEDIR_CMD}" \
--cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \ --cmd 'au SwapExists * let v:swapchoice = "e"' $t $T \
>&3\
&& [ -f $t.res ]; then && [ -f $t.res ]; then
echo "%PASS: $t PASSED" echo "%PASS: $t PASSED"
else else
@ -117,7 +138,13 @@ for t in ${TESTS}; do
${RUN_VIM} --version > ${TESTLOGDIR}/vimversion ${RUN_VIM} --version > ${TESTLOGDIR}/vimversion
if [ "$VIMSPECTOR_TEST_STDOUT" = "messages" ]; then if [ "$VIMSPECTOR_TEST_STDOUT" = "messages" ]; then
if [ -f messages ]; then if [ -f messages ]; then
echo "%MESSAGES"
cat messages cat messages
echo "%END"
else
echo "%MESSAGES"
echo "No messages found"
echo "%END"
fi fi
fi fi
@ -138,6 +165,10 @@ for t in ${TESTS}; do
rm -f $t.res rm -f $t.res
done done
# close out_fd if it's not stdout/stderr/
(( out_fd > 2 )) && exec 3>&-
echo "Done running tests" echo "Done running tests"
popd > /dev/null popd > /dev/null