#!/bin/bash
#------------------------------------------------------------------------------
# This wrapper to test_cbd.sh defines recommended flags for use with continuous integration testing.
# Use '-L off' since CI builds do their own log handling, so there's no need to use the built-in log features.

set -u
set -e

export CBD_HOME=${CBD_HOME:-Undefined}
export BUILD_TAG=${BUILD_TAG:-Undefined}

if [[ "${CBD_HOME}" == Undefined ]]; then
   echo -e "\nError: CBD_HOME not defined. Aborting.\n"
   exit 1
fi

export P4U_HOME="$(dirname $CBD_HOME)/p4/common/lib"
export P4U_LIB=$P4U_HOME

echo "Setting path to include python3+p4python."
export PATH="$(dirname $CBD_HOME)/p4/common/python/bin:$PATH"

echo "Build Tag: $BUILD_TAG"

$CBD_HOME/test/test_cbd.sh -a -L off -I

exit $?
