#!/bin/bash

. buildsys/functions

ProcessArgs $*
Assert LoadConfigs
Assert SetupLogDir
Assert SetupResFile

cd ../../..

SetState Testing
ArchiveLogs

if [ "$DEP" != "none" ]
then
   OSPL_HOME=$DEPWORKDIR
   export OSPL_HOME
fi

SPLICE_PLATFORM=$SETUP_TYPE
export SPLICE_PLATFORM
. ./configure -full

if [ "$CONFIGURATION" != "OK" ]
then
   echo  "ERROR: configuration - dcps_build_rbt_tests"
   exit 1
fi

echo "BUILD/RBT=RUNNING" >> $RESFILE
ArchiveLogs

cd testsuite ||
{ 
    echo "ERROR: could not cd to testsuite dir - dcps_build_rbt_tests"; 
    exit 2; 
}
make
if [ $? != 0 ] 
then
    echo "ERROR: building testsuite - dcps_build_rbt_tests"; 
    exit 3
fi
 
cd rbt ||
{ 
    echo "ERROR: could not cd to rbt dir - dcps_build_rbt_tests"; 
    exit 4; 
}
make 
if [ $? = 0 ] 
then
    exit 0
else
    exit 5
fi
