# included by tests scripts

test_result_want_fail() {
  set +x
  if [ $1 = 0 ]; then
    echo "\n  --:Test failure:--"
    exit 1
  fi

  echo "  -:Test passed:-"
  set -x
}

export RMWTEST_HOME

if [ -e $RMWTEST_HOME ]; then
  rm -rf $RMWTEST_HOME
fi

RMW_TEST_CMD_STRING="$BIN_DIR/rmw -c $CONFIG"

if [ "$USE_VALGRIND" != "0" ]; then
  if [ -z `which valgrind` ]; then
    echo "Valgrind isn't installed"
  else
    USE_VALGRIND=`which valgrind`
    RMW_TEST_CMD_STRING="$USE_VALGRIND --leak-check=full --show-leak-kinds=all --error-exitcode=1 $RMW_TEST_CMD_STRING"
  fi
fi

PRIMARY_WASTE_DIR=$RMWTEST_HOME/.Waste

RMW_ALT_TEST_CMD_STRING="$BIN_DIR/rmw -c $ALT_CONFIG"
RMW_PURGE_DISABLED_CMD="$BIN_DIR/rmw -c $PURGE_DISABLED_CONFIG"
SEPARATOR="\n\n--- "
