robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
af23d17388
master
1#!/usr/bin/env bash 2 3main () {( 4 localseparator ="================================================================================" 5 localoldesttest = 6if test " $ 1 " ="--oldesttest" ;then 7shift 8oldesttest =1 9fi 10 localroot =" $ 1 " ;shift 11 localnvim_prg =" $ 1 " ;shift 12 localtest_name =" $ 1 " ;shift 13 14 localtlog =" $ test_name .tlog" 15 16export NVIM_TEST_ARGC =$ # 17 localarg 18 locali =0 19# shellcheck disable=SC2034 # (unused "arg", used in "eval"). 20for arg ;do 21eval "export NVIM_TEST_ARG $ i =\"\$arg\"" 22i =$((i +1 )) 23done 24 25BUILD_DIR =" $( dirname " $ nvim_prg " ) /.." 26export BUILD_DIR 27export FAILED =0 28 29. $( dirname $ 0) /test.sh 30 31# Redirect XDG_CONFIG_HOME so users local config doesn't interfere 32export XDG_CONFIG_HOME =" $ root " 33 34export VIMRUNTIME =" $ root /runtime" 35if !" $ nvim_prg " \ 36-u NONE-i NONE \ 37--headless \ 38--cmd 'set shortmess+=I noswapfile noundofile nomore' \ 39-S runnvim.vim \ 40" $ tlog " > "out- $ tlog " 2 > "err- $ tlog " 41then 42fail " $ test_name " "Nvim exited with non-zero code" 43fi 44 { 45echo "Stdout of :terminal runner" 46echo " $ separator " 47cat "out- $ tlog " 48echo " $ separator " 49echo "Stderr of :terminal runner" 50echo " $ separator " 51cat "err- $ tlog " 52echo " $ separator " 53 }>> " $ tlog " 54if test " $ oldesttest " = 1 ;then 55if !diff -q test.out" $ test_name .ok" > /dev/null2 >&1 ;then 56if test -f test.out ;then 57fail " $ test_name " "Oldest test .out file differs from .ok file" 58 { 59echo "Diff between test.out and $ test_name .ok" 60echo " $ separator " 61diff -a test.out" $ test_name .ok" 62echo " $ separator " 63 }>> " $ tlog " 64else 65echo "No output in test.out" >> " $ tlog " 66fi 67fi 68fi 69valgrind_check . 70if test -n " $ LOG_DIR " ;then 71check_sanitizer " $ LOG_DIR " 72fi 73check_core_dumps 74if test " $ FAILED " = 1 ;then 75cat " $ tlog " 76fi 77rm -f " $ tlog " 78if test " $ FAILED " = 1 ;then 79echo "Test $ test_name failed, see output above and summary for more details" >> test.log 80# When Neovim crashed/aborted it might not have created messages. 81# test.log itself is used as an indicator to exit non-zero in the Makefile. 82if !test -f message;then 83cp -a test.log messages 84fi 85fi 86)} 87 88main " $ @"