#!/bin/sh -e

pkg=pbbarcode

if [ "$ADTTMP" = "" ] ; then
  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
  trap "rm -rf $ADTTMP" 0 INT QUIT ABRT PIPE TERM
fi

cp -a /usr/share/doc/${pkg}/etc $ADTTMP
cp -a /usr/share/doc/${pkg}/tests $ADTTMP

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

find tests -name "*.py" | xargs nosetests

exit 0

# remove some test that takes incredibly long time to end up in a 'timed out' failure in autopkgtest
find tests/cram -name "*.t" | grep -v consensus.t | xargs cram --verbose

# I have tried the very first part of this test which translates to
cd etc
python -c "from pbcore import data ; print data.getBasH5s()[0]" > bas.fofn
python -c "from pbcore import data ; print data.getBasH5s()[1]" >> bas.fofn 
pbbarcode labelZmws barcode.fasta  bas.fofn
# and even this takes long enough that I decided to kill the process
# So probably this is nothing we should push to the autopkgtest infrastructure
# Question: is this working at all?
