#!/bin/sh
# autopkgtest check: build and run with default test data
# This test is similar to installation-test, yet it differs: it loads tests 
# commands from current version of upstream's src/scr/test-install.pl and 
# checks the results (only loads tests with all example files present, tests 
# which are not working because of no files are commented).
# Author: Tatiana Malygina <merlettaia@gmail.com>

set -e

pkg=profphd

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

cd $ADTTMP

cp -a /usr/share/${pkg}/prof/exa/* .
find . -type f -name "*.gz" -exec gunzip \{\} \;
for lnk in `find . -type l -name "*.gz"` ; do
    ln -s `basename $(readlink $lnk) .gz` `echo $lnk | sed 's/\.gz$//'`
    rm $lnk
done

prof 1ppt.hssp fileRdb=tst-1ppt.rdbProfSec sec ascii
[ -z $(cmp -s tst-1ppt.rdbProfSec 1ppt.hssp.prof) ]
prof 1ppt.hssp fileRdb=tst-1ppt.rdbProfAcc acc ascii
[ -s tst-1ppt.rdbProfAcc ]
prof 1ppt.hssp fileRdb=tst-1ppt.rdbProfBoth both ascii
[ -s tst-1ppt.rdbProfBoth ]
prof 1ppt.hssp fileRdb=tst-1ppt.rdbProf ascii
[ -s tst-1ppt.rdbProf ]
#prof 1prc.hssp_L fileRdb=tst-1prcL.rdbProfSec sec ascii
#prof 1prc.hssp_L fileRdb=tst-1prcL.rdbProfAcc acc ascii
#prof 1prc.hssp_L fileRdb=tst-1prcL.rdbProfHtm htm ascii
#prof 1prc.hssp_L fileRdb=tst-1prcL.rdbProf ascii
#prof 1shg.hssp fileRdb=tst-1shg.rdbProf both ascii saf fileAli=tst-1shg.profSaf dssp fileDssp=tst-1shg.profDssp
#prof 1shg.hssp fileRdb=tst-1shg.rdbProfFilter both ascii filter optFilter=red=70 msf fileAli=tst-1shg.profFilterMsf
#prof 256b.dssp fileRdb=tst-256b.rdbProfSec sec ascii

prof 2ppt.fastamul fileRdb=tst-2ppt.rdbProfSec sec ascii
[ -z $(cmp -s tst-2ppt.rdbProfSec 2ppt.rdbProfSec) ]

prof 8rnt.msf fileRdb=tst-8rnt.rdbProfSec sec ascii
# for now above line produces following warnings several times:
#Redundant argument in printf at /usr/share/perl5/RG/Utils/Copf.pm line 6536.
#Redundant argument in printf at /usr/share/perl5/RG/Utils/Copf.pm line 6308.
prof 9rnt.saf fileRdb=tst-9rnt.rdbProfSec sec ascii
