1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/bin/sh
# autopkgtest check: build and run with default test data
# Author: Tatiana Malygina <merlettaia@gmail.com>
set -e
pkg=proftmb
if [ "$AUTOPKGTEST_TMP" = "" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/${pkg}/examples/* .
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
echo "Run proftmb..."
# call example from man:
proftmb @/usr/share/${pkg}/options -q example.Q -o result
echo "Checking output files existance..."
#according to man, there should be 3 files:
[ -s result_proftmb_tabular.txt ]
[ -s result_proftmb_pretty.txt ]
[ -s result_dat.txt ]
[ -s example_proftmb_tabular.txt ]
[ -s example_proftmb_pretty.txt ]
[ -s example_dat.txt ]
#compare them with expected example output:
echo "Comparing result with expected example output..."
[ -z $( cmp -s result_proftmb_tabular.txt example_proftmb_tabular.txt ) ]
echo "...files result_proftmb_tabular.txt and example_proftmb_tabular.txt match"
[ -z $( cmp -s result_proftmb_pretty.txt example_proftmb_pretty.txt ) ]
echo "...files result_proftmb_pretty.txt and example_proftmb_pretty.txt match"
[ -z $( cmp -s result_dat.txt example_dat.txt ) ]
echo "...files result_dat.txt and example_dat.txt match"
|