2018-03-17 16:38:27 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
main() {(
|
2018-03-18 14:53:40 -07:00
|
|
|
local separator="================================================================================"
|
2018-03-17 16:38:27 -07:00
|
|
|
local oldesttest=
|
|
|
|
if test "$1" = "--oldesttest" ; then
|
|
|
|
shift
|
|
|
|
oldesttest=1
|
|
|
|
fi
|
|
|
|
local root="$1" ; shift
|
|
|
|
local nvim_prg="$1" ; shift
|
|
|
|
local test_name="$1" ; shift
|
|
|
|
|
|
|
|
local tlog="$test_name.tlog"
|
|
|
|
|
|
|
|
export NVIM_TEST_ARGC=$#
|
|
|
|
local arg
|
|
|
|
local i=0
|
|
|
|
for arg ; do
|
|
|
|
eval "export NVIM_TEST_ARG$i=\"\$arg\""
|
|
|
|
i=$(( i+1 ))
|
|
|
|
done
|
|
|
|
|
|
|
|
export CI_DIR="$root/ci"
|
|
|
|
export BUILD_DIR="$(dirname "$nvim_prg")/.."
|
|
|
|
export FAILED=0
|
|
|
|
|
|
|
|
. "$CI_DIR/common/suite.sh"
|
|
|
|
. "$CI_DIR/common/test.sh"
|
|
|
|
|
|
|
|
export VIMRUNTIME="$root/runtime"
|
|
|
|
if ! "$nvim_prg" \
|
|
|
|
-u NONE -i NONE \
|
|
|
|
--headless \
|
|
|
|
--cmd 'set shortmess+=I noswapfile noundofile nomore' \
|
|
|
|
-S runnvim.vim \
|
2018-03-18 14:53:40 -07:00
|
|
|
"$tlog" > "out-$tlog" 2> "err-$tlog"
|
2018-03-17 16:38:27 -07:00
|
|
|
then
|
|
|
|
fail "$test_name" F "Nvim exited with non-zero code"
|
|
|
|
fi
|
2018-03-18 14:53:40 -07:00
|
|
|
echo "Stdout of :terminal runner" >> "$tlog"
|
|
|
|
echo "$separator" >> "$tlog"
|
|
|
|
cat "out-$tlog" >> "$tlog"
|
|
|
|
echo "$separator" >> "$tlog"
|
|
|
|
echo "Stderr of :terminal runner" >> "$tlog"
|
|
|
|
echo "$separator" >> "$tlog"
|
|
|
|
cat "err-$tlog" >> "$tlog"
|
|
|
|
echo "$separator" >> "$tlog"
|
2018-03-17 16:38:27 -07:00
|
|
|
if test "$oldesttest" = 1 ; then
|
|
|
|
if ! diff -q test.out "$test_name.ok" > /dev/null 2>&1 ; then
|
|
|
|
if test -f test.out ; then
|
|
|
|
fail "$test_name" F "Oldest test .out file differs from .ok file"
|
|
|
|
echo "Diff between test.out and $test_name.ok" >> "$tlog"
|
2018-03-18 14:53:40 -07:00
|
|
|
echo "$separator" >> "$tlog"
|
2018-03-17 16:38:27 -07:00
|
|
|
diff -a test.out "$test_name.ok" >> "$tlog"
|
2018-03-18 14:53:40 -07:00
|
|
|
echo "$separator" >> "$tlog"
|
2018-03-17 16:38:27 -07:00
|
|
|
else
|
|
|
|
echo "No output in test.out" >> "$tlog"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$FAILED" = 1 ; then
|
|
|
|
travis_fold start "$NVIM_TEST_CURRENT_SUITE/$test_name"
|
|
|
|
fi
|
|
|
|
valgrind_check .
|
|
|
|
if test -n "$LOG_DIR" ; then
|
|
|
|
asan_check "$LOG_DIR"
|
|
|
|
fi
|
|
|
|
check_core_dumps
|
|
|
|
if test "$FAILED" = 1 ; then
|
|
|
|
cat "$tlog"
|
|
|
|
fi
|
|
|
|
rm -f "$tlog"
|
|
|
|
if test "$FAILED" = 1 ; then
|
|
|
|
travis_fold end "$NVIM_TEST_CURRENT_SUITE/$test_name"
|
|
|
|
fi
|
|
|
|
if test "$FAILED" = 1 ; then
|
|
|
|
echo "Test $test_name failed, see output above and summary for more details" >> test.log
|
|
|
|
fi
|
|
|
|
)}
|
|
|
|
|
|
|
|
main "$@"
|