neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

test.sh (1980B)


      1 fail() {
      2  local test_name="$1"
      3  local message="$2"
      4 
      5  : "${message:=Test $test_name failed}"
      6 
      7  local full_msg="$test_name :: $message"
      8  echo "Failed: $full_msg"
      9  export FAILED=1
     10 }
     11 
     12 print_core() {
     13  local app="$1"
     14  local core="$2"
     15  if test "$app" = quiet ; then
     16    echo "Found core $core"
     17    return 0
     18  fi
     19  echo "======= Core file $core ======="
     20  if test "${CI_OS_NAME}" = osx ; then
     21    lldb -Q -o "bt all" -f "${app}" -c "${core}"
     22  else
     23    gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
     24  fi
     25 }
     26 
     27 check_core_dumps() {
     28  local del=
     29  if test "$1" = "--delete" ; then
     30    del=1
     31    shift
     32  fi
     33  local app="${1:-${BUILD_DIR}/bin/nvim}"
     34  local cores
     35  if test "${CI_OS_NAME}" = osx ; then
     36    cores="$(find /cores/ -type f -print)"
     37    local _sudo='sudo'
     38  else
     39    cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)"
     40    local _sudo=
     41  fi
     42 
     43  if test -z "${cores}" ; then
     44    return
     45  fi
     46  local core
     47  for core in $cores; do
     48    if test "$del" = "1" ; then
     49      print_core "$app" "$core" >&2
     50      "$_sudo" rm "$core"
     51    else
     52      print_core "$app" "$core"
     53    fi
     54  done
     55  if test "$app" != quiet ; then
     56    fail 'cores' 'Core dumps found'
     57  fi
     58 }
     59 
     60 check_logs() {
     61  # Iterate through each log to remove a useless warning.
     62  # shellcheck disable=SC2044
     63  for log in $(find "${1}" -type f -name "${2}"); do
     64    sed -i "${log}" \
     65      -e '/Warning: noted but unhandled ioctl/d' \
     66      -e '/could cause spurious value errors to appear/d' \
     67      -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
     68  done
     69 
     70  # Now do it again, but only consider files with size > 0.
     71  local err=""
     72  # shellcheck disable=SC2044
     73  for log in $(find "${1}" -type f -name "${2}" -size +0); do
     74    cat "${log}"
     75    err=1
     76    rm "${log}"
     77  done
     78  if test -n "${err}" ; then
     79    fail 'logs' 'Runtime errors detected.'
     80  fi
     81 }
     82 
     83 valgrind_check() {
     84  check_logs "${1}" "valgrind-*"
     85 }
     86 
     87 check_sanitizer() {
     88  check_logs "${1}" "*san.*"
     89 }