#!/bin/sh -e

TOP_SRCDIR=`dirname $0`/..

export DBA_REPINFO=$TOP_SRCDIR/tables/repinfo.csv
export DBA_TABLES=$TOP_SRCDIR/tables
export DBA_TESTDATA=$TOP_SRCDIR/extra

CMD="$1"

#id=`date +%y%m%d%H%M%S`
#$DEBUGGER $BIN $ARGS 2>&1 | tee `pwd`/testrun-$id
#echo Output saved in `pwd`/testrun-$id

# Try to debug the libtool executable, if present
DIR=`dirname $CMD`
BASE=`basename $CMD`
if [ ! -z "$DEBUGGER" ] && [ -x $DIR/.libs/lt-$BASE ]
then
	echo "Running $DEBUGGER $DIR/.libs/lt-$BASE $ARGS"
	$DEBUGGER $DIR/.libs/lt-$BASE $ARGS
else
	echo "Running $DEBUGGER $CMD $ARGS"
	$DEBUGGER $CMD $ARGS
fi

exit $?
