#!/bin/sh

set -e

if [ -d "$AUTOPKGTEST_TMP" ] ; then
    cp debian/tests/trecipe.c "$AUTOPKGTEST_TMP"
    cd "$AUTOPKGTEST_TMP"
fi

echo "dlname='trecipe.so'" > trecipe.la
gcc -Wall trecipe.c -lcplcore -lcplui -fPIC -shared -o libtrecipe.so

esorex --recipe-dir "$AUTOPKGTEST_TMP" --recipes
if [ $? != 0 ] ; then
    echo "Recipe listing failure"
    exit 1
fi

RECIPE=recipe

esorex --recipe-dir "$AUTOPKGTEST_TMP" --man-page ${RECIPE}
if [ $? != 0 ] ; then
    echo "Recipe doc printing failure"
    exit 1
fi
esorex --recipe-dir "$AUTOPKGTEST_TMP" --param ${RECIPE}
if [ $? != 0 ] ; then
    echo "Recipe parameter listing failure"
    exit 1
fi
cat esorex.log
rm -f esorex.log
