#!/bin/sh

set -e

# Sanity check
test -n "${AUTOPKGTEST_TMP}"

# Copy all tests to an empty directory and change to it.
cp -pr tests "${AUTOPKGTEST_TMP}/"
cd "${AUTOPKGTEST_TMP}/"

# Use installed copy instead of built one
sed -e 's:\$builddir/src/zile:/usr/bin/zile:g' -i tests/run-lisp-tests.pl

# Run all tests. Use a hardcoded dumb terminal to avoid test failures
# if $TERM is unset. Has the nice side-effect that running the tests
# in a local xterm doesn't leave the xterm in an unusable state
# afterwards.
env TERM=vt100 perl tests/run-lisp-tests.pl $(find tests -name '*.el')
