#!/bin/sh -e

pkg=r-cran-coin

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/${pkg}/tests/* $AUTOPKGTEST_TMP
gunzip -r *.gz
for runtest in `ls *.R` ; do
   LC_ALL=C R --no-save < $runtest >/dev/null
   if [ ! $? ] ; then
     echo "Test ${runtest} failed"
     exit 1
   else
     echo "Test ${runtest} passed"
   fi
done
rm -rf $AUTOPKGTEST_TMP/*
