atf_build


#!/bin/bash

rm -rf ~/atf/dbin
mkdir -p ~/atf/dbin

rm -rf ~/atf/rbin
mkdir -p ~/atf/rbin

# today's date-time in format yyyymmdd
TODAY=`date +%Y%m%d`

LOGDIR=~/atf/logs/$TODAY
rm -rf $LOGDIR
mkdir -p $LOGDIR

runcommand()
{
    echo "*****************************************************************************************************"
    echo $1

    echo "*****************************************************************************************************" >>$LOGDIR/$2
    echo $1 >>$LOGDIR/$2
    echo "*****************************************************************************************************" >>$LOGDIR/$2
    $1 2>&1 >>$LOGDIR/$2
    echo "" >>$LOGDIR/$2
}

buildworkspace()
{
    runcommand "Xcpp $1.xcpp mode=gen" build_$1

    # debug configuration	
    #runcommand "make dclean" build_$1
    runcommand "make d" build_$1

    # release configuration	
    #runcommand "make rclean" build_$1
    runcommand "make r" build_$1
}

# update from ceda wush repository
runcommand cedasvnup svnup

# rebuild xcpp
runcommand xcppgen buildxcpp
runcommand xcppbuild buildxcpp
runcommand xcppcopy buildxcpp

# rebuild wsObject workspace
cd ~/developer/build_linuxx64/build
buildworkspace wsUtils
buildworkspace wsMessage
#buildworkspace wsMiddleware
buildworkspace wsLss
buildworkspace wsObject
buildworkspace wsCedaScript
buildworkspace wsPersistStore
buildworkspace wsOperation
buildworkspace wsPython
buildworkspace wsThread
buildworkspace wsRmi
buildworkspace wsJigsaw
buildworkspace wsJigsawServer

runtest()
{
    runcommand "./$1 $2" $1
}

runexamples()
{
    runtest exThread
    runtest exLss
    #runtest exMiddleware
    runtest exRmi
    runtest exObject
    runtest exOperation
    runtest exCedaScript
    runtest exPersistStore
    runtest exPython
    runtest exPython2
}

runtests()
{
    runtest txThread $1
    runtest txUtils $1
    runtest txLss $1
    runtest txMessage $1
    runtest txObject $1
    runtest txPersistStore $1
    runtest txOperation $1
    runtest txPython $1
}

# run debug tests
cd ~/atf/dbin
cp ~/developer/build_linuxx64/lib/Linuxx64/Debug/* .
runexamples
runtests 60

# run release tests
cd ~/atf/rbin
cp ~/developer/build_linuxx64/lib/Linuxx64/Release/* .
runexamples
runtests 60

# generate
# alias g='cd ~/developer/build_linuxx64/build;Xcpp wsUtils.xcpp mode=gen'

# clean
# alias c='cd ~/developer/build_linuxx64/build;make dclean'

# build
# alias b='cd ~/developer/build_linuxx64/build;make d'

# run
# alias r='~/developer/build_linuxx64/lib/Linuxx64/Debug/txUtils'

# status
# alias s='cd ~/developer/_root_/Ceda;svn status --show-updates'