#!/bin/sh

# Leave the following line in the skeleton as the
# installer replaces it with root of the installation directory
TET_ROOT=/usr/lib/lsb-testsuites

if [ ! $TET_ROOT ]; then
  echo "Script has not been installed correctly. Please use the provided" 
  echo "installaton script to install TET/vsxgen and the test suites"
  exit 1
fi

export TET_ROOT

# Check installation
if [ ! -f $TET_ROOT/profile ]; then
  echo Cannot find installation or it is misconfigured
  echo Aborting.
  exit 1
fi

# Build and install TET
cd $TET_ROOT && . ./profile
echo "----------------------------------------------------------------------"
echo "Building/Installing TET"

cd src && make install

if [ $? -ne 0 ]; then
  echo "Build/Install of TET failed. Aborting."
fi

# Build and install testsets
cd ../test_sets && . ./profile
echo "----------------------------------------------------------------------"
echo "Building/Installing test sets"

sh setup_testsets.sh
