#!/bin/bash -f
t=${0##*/}; TEST_NAME=${t:5}   # basename $0 with 'test-' stripped off

[ -z "$builddir" ] && export builddir=$PWD

. ${builddir}/check-common.sh

if [[ $srcdir != $builddir ]] ; then
    echo "Skipping when building outside the source tree"
    exit 77
fi
case $host_os in 
    cygwin | darwin* | solaris* )
	exit ;;
    * )
	: ;;
esac

TEST_FILE="$builddir/${TEST_NAME}.check"

if (( 3 == ${BASH_VERSINFO[0]} )) ; then
    test_script=${TEST_NAME}-3.tests
elif (( 4 == ${BASH_VERSINFO[0]} )) ; then
    test_script=${TEST_NAME}.tests
fi

(cd $srcdir && $SH ${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null)

check_output $TEST_FILE ${top_builddir}/test/data/${TEST_NAME}.right

rm -f $top_builddir/test/interrupt.tst

exit $?
