#!/bin/bash
set -e

pkg=lumpy-sv

export LC_ALL=C.UTF-8
if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
#  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

set -x
cp -a /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"
gunzip -r *

cd test

sed -i -e 's:\.\./scripts:/usr/share/lumpy-sv/scripts:' \
       -e 's:\.\./bin/lumpy:/usr/bin/lumpy:' \
    *.sh 

./test.sh

# Testing lumpy paired-end
# ./bp_pe_pl.sh: line 26 refers to /usr/share/lumpy-sv/scripts/pairend_distro.pl
# but there is only /usr/share/lumpy-sv/scripts/pairend_distro.py ... but with different options
# ./test_pl.sh
#  FIXME: contact upstream

# FIXME: needs more work
# cd ../lumpy_tests
# sh test.sh
