#!/bin/sh

set -e -u

# copy tests and test data
cp --verbose --archive tests/ "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
# symlink the packaged par2 executable
ln --verbose --symbolic /usr/bin/par2 "$AUTOPKGTEST_TMP"

# disarm -e to ensure all tests are run even if some fail
set +e
RETVAL=0

for t in $(find tests/ -name 'test*' -executable -type f | sort -V); do
	echo "$t:"
	/bin/sh "$t" 2>&1
	RETVAL=$((RETVAL + $?))
done

exit $RETVAL
