#!/bin/sh -e

pkg=r-cran-dosefinding
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 *.gz
for runtest in *.R ; do
    if [ "$runtest" = "testsplotDRMod.R" ] ; then
       echo "$runtest consists only from comments and returns non-zero exit value ... ignored"
    else
       Rscript $runtest
       RET=$?
       if [ $RET -eq 0 ] ; then
           echo $runtest passed
       else
           echo $runtest failed with return code $RET
           exit 1
       fi
    fi
done
#rm -f $AUTOPKGTEST_TMP/*
#exit 0
