#!/bin/sh
# autopkgtest check based on upstream check ($ make -C test)
# written for Debian by Jerome Benoit <calculus@rezozer.net> on behalf of the Debian Tex Maintainers team
# copyright: 2015-2020 Jerome Benoit <calculus@rezozer.net>
# distributed under the terms and conditions of GPL version 2 or later

set -ue

cp -prd test $AUTOPKGTEST_TMP

cat << EOF > $AUTOPKGTEST_TMP/test/GNUmakefile
#!/usr/bin/make -f

PERL = /usr/bin/perl

BIBTOOLPROG = /usr/bin/bibtool

default:

check:
	BIBTOOL_PRG=\$(BIBTOOLPROG) \$(PERL) -Ilib -MBUnit -e "exit all()" || ( find . -name '*.err*' -o -name '*.out*' -printf "\n%f" | sort | xargs tail -n +1 ; exit 1 ; )

clean:
	rm -f *.out* *.err*

EOF

make -C $AUTOPKGTEST_TMP/test check

exit 0
