#!/bin/sh -e

pkg=r-cran-r.oo

if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $ADTTMP
cp /usr/share/doc/${pkg}/tests/* $ADTTMP
find . -name "*.gz" -exec gunzip \{\} \;
for htest in `ls *.R | sed 's/\.R$//'` ; do
   LC_ALL=C R --no-save < ${htest}.R 2>&1 | tee > ${htest}.Rout
   if [ ! $? ] ; then
     echo "Test ${htest} failed"
     exit 1
   else
     echo "Test ${htest} passed"
   fi
done
rm -f $ADTTMP/*

exit 0
