#!/bin/sh

UNIT_TEST=$1
shift

test -z ${UNIT_TEST} && {
        echo "Usage: $0 UNIT_TEST"
        exit 1
}

UNIT_TEST=`echo $UNIT_TEST|sed 's/-/_/g'`

echo "Running: ./test-conformance ${UNIT_TEST} $@"
echo ""
if test -f @abs_builddir@/test-conformance; then
  TEST_CONFORMANCE=@abs_builddir@/test-conformance
elif test -f @abs_builddir@/test-conformance.exe; then
  TEST_CONFORMANCE=@abs_builddir@/test-conformance.exe
fi
COGL_TEST_VERBOSE=1 $TEST_CONFORMANCE ${UNIT_TEST} "$@"
exit_val=$?

echo ""
echo "NOTE: For debugging purposes, you can run this single test as follows:"
echo "$ libtool --mode=execute \\"
echo "          gdb --eval-command=\"b ${UNIT_TEST}\" \\"
echo "          --args ./test-conformance ${UNIT_TEST}"
echo "or:"
echo "$ env G_SLICE=always-malloc \\"
echo "  libtool --mode=execute \\"
echo "          valgrind ./test-conformance ${UNIT_TEST}"

exit $exit_val
