#!/bin/sh -e

debname=r-cran-riskregression

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 *
cd tests
# do not run a few tests to prevent circular test-dep on pec and rest to avoid test-dep on randomforestsrc and mstate
rm -f test-score.R test-CauseSpecificCoxRegression.R test-predictCSC.R test-predictRisk.R
for testfile in *.R; do
    echo "BEGIN TEST $testfile"
    LC_ALL=C.UTF-8 R --no-save < $testfile
done

