#!/bin/sh

# Make sure $ADTTMP is available
if [ "${ADTTMP}"F = "F" ]; then
   echo "Error: expected environment variable ADTTMP is not set."
   exit 1
fi

# Make sure $ADT_ARTIFACTS is available
if [ "${ADT_ARTIFACTS}"F = "F" ]; then
   echo "Error: expected environment variable ADT_ARTIFACTS is not set."
   exit 1
fi

# Determine locations of required tools
SOURCE_TREE="${PWD}"
CBACK="/usr/bin/cback"

# Print a test summary
echo ""
echo "========================================================================="
echo "Running ${0}"
echo "========================================================================="
echo "SOURCE_TREE..: ${SOURCE_TREE}"
echo "ADTTMP.......: ${ADTTMP}"
echo "ADT_ARTIFACTS: ${ADT_ARTIFACTS}"
echo "CBACK........: ${CBACK}"
echo "========================================================================="
echo ""

# Always run tests from within $ADTTMP
cd ${ADTTMP}

# Run cback --diagnostics and confirm that it runs without problems
${CBACK} --diagnostics
if [ $? != 0 ]; then
   exit 1
fi

# Close the test
echo ""

