#!/bin/sh -e

pkgname=lmerTest
debname=r-cran-lmertest

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
    AUTOPKGTEST_TMP=`mktemp -d /tmp/${debname}-test.XXXXXX`
    trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/$debname/tests/* $AUTOPKGTEST_TMP
gunzip -r *

hostarch=$(dpkg-architecture -qDEB_HOST_ARCH)
# Drop one test on i386 architecture to work around bug #1017631
if [ "$hostarch" = "i386" ] ; then
  sed -i '/# Model of the form (f1 + f2 | gr):/,/^# Model/d' test_ranova_step.R
fi

for testfile in *.R; do
    echo "BEGIN TEST $testfile"
    LC_ALL=C R --no-save < $testfile
done

