#!/bin/sh -e

if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/python-pysam-test.XXXXXX`
fi
cp -ra /usr/share/doc/python-pysam/data/* $ADTTMP

# FIXME!!
# That's a pretty strange hack but without it the dynamic libraries are not found
# Need to be tracked down before uploading
cd /usr/lib/python2.7/dist-packages/pysam
gnutype=`dpkg-architecture -qDEB_TARGET_GNU_TYPE`
for so in *.${gnutype}.so ; do sudo ln -sf $so `basename $so .${gnutype}.so`.so ; done

cd $ADTTMP
find . -name "*.gz" -exec gunzip -f \{\} \;

nosetests --nocapture -v
cd
# rm -rf $ADTTMP

