#! /bin/sh

# The test harness, used invoked through LOG_COMPILER
# in testsuite/local.mk .
# Current directory is '$top_builddir'.

: ${MAKE=make}
: ${srcdir=.}
: ${SED="./sed/sed"}

makefile="${abs_top_srcdir}/testsuite/Makefile.tests"

# Strip the directory './testsuite/' from the test name.
test=`echo "$@"| sed 's,.*/,,'`

# Skip the utility programs, they are not standalone tests
test "$test" = get-mb-cur-max \
    || test "$test" = test-mbrtowc \
    && exit 77

exitcode=0
$MAKE SED="$SED" srcdir="$srcdir/testsuite" -f "$makefile" $test || exitcode=$?
test -f $test.skip && exitcode=77
rm -f $test.skip
exit $exitcode
