#!/bin/sh -e

pkgname=ps
debname=r-cran-ps

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 *
for testfile in *.R; do
    echo "BEGIN TEST $testfile"
    # Two of the tests will fail if it is not running inside a terminal - so the xterm call is important
    LC_ALL=C /usr/bin/xvfb-run --auto-servernum --server-num=20 -s "-screen 0 1024x768x24 -noreset" xterm  -e /bin/sh -c "R --no-save < $testfile 2>&1 | tee > test.out"
    cat test.out
    rm test.out
done

