#!/bin/sh
# use target=recheck if you want to recheck failing tests
[ "$target" = "" ] && target=check

# Without --ignore-exit, the tap harness causes any FAILs within a
# test plan to raise ERRORs; this is just noise.
makeargs="LOG_DRIVER_FLAGS=--ignore-exit abs_top_srcdir=$PWD abs_top_builddir=$PWD"

declare -x BT_TESTS_BABELTRACE_PLUGIN_PATH="/usr/lib/babeltrace2/ptest/tests/utils/python"
declare -x BT_TESTS_PROVIDER_DIR="/usr/lib/babeltrace2/plugin-providers"

exec 2> error.log
make -C tests -k -s $makeargs $target
exitcode=$?
if [ -e error.log ]; then
    cat error.log
fi
if [ -e tests/test-suite.log ]; then
    cat tests/test-suite.log
fi

exit $exitcode
