#!/bin/sh -e

pkg=circos
if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $ADTTMP
cp -a /usr/share/doc/$pkg/examples/* $ADTTMP
ln -s /etc/circos/tracks etc
find . -name "*.gz" -exec gunzip \{\} \;
cp -a etc/circos.svg circos-orig.svg
mv circos.png circos-orig.png
./run
if [ ! -e circos.svg ] ; then
    echo "Test failed"
    exit 1
fi

if ! diff -q circos-orig.svg circos.svg > /dev/null ; then
    echo "SVG results are different! Please check the results."
fi

if ! cmp --quiet circos-orig.png circos.png ; then
    echo "PNG results are different! Please check the results"
fi
