| #!/bin/sh |
| |
| #BUILD_ID=master |
| BUILD_ID=$1 |
| BUILDTYPE=$4 |
| TOPNAME=$5 |
| EXTRAOPTS=$6 |
| |
| if [ -z "$BUILD_ID" ]; then |
| echo "Usage $0 <build-id> <modelname> <modeldirname> $BUILDTYPE [<top>]" |
| exit 1 |
| fi |
| |
| if [ -z ${build_dir+x} ]; then |
| build_dir=/opt/public/download-staging.priv/papyrus-rt/ |
| fi |
| |
| if [ -z "$TOPNAME" ]; then |
| $TOPNAME="TopMain" |
| fi |
| |
| script_dir=`dirname $0` |
| modelname=$2 |
| repodir=$3 |
| |
| echo "* Test parameters:" |
| echo " - Build dir is: '$build_dir'" |
| echo " - Model to test is: '$modelname'" |
| echo " - Model repodir is: '$repodir'" |
| echo " - Build type is: '$BUILDTYPE'" |
| echo " - Topname is: '$TOPNAME'" |
| |
| base_package=$build_dir/mars/mars.tar.gz |
| install_dir=$build_dir/autotest.$BUILD_ID.install |
| src_dir=$build_dir/autotest.$BUILD_ID.src |
| ws_dir=$build_dir/autotest.$BUILD_ID.ws |
| |
| rm -rf $install_dir $src_dir $ws_dir |
| |
| echo "* Installing $BUILD_ID to '$install_dir'" |
| |
| #trap "echo removing $install_dir $src_dir $ws_dir; rm -rf $install_dir $src_dir $ws_dir" EXIT |
| |
| resource=`readlink -f $base_package` |
| echo "* Expanding base installation for `basename ${resource%.*}`" |
| mkdir $install_dir |
| tar zxf $base_package -C $install_dir |
| echo "* Untar done" |
| |
| echo "* Installing $BUILD_ID" |
| |
| $install_dir/eclipse/eclipse \ |
| -application org.eclipse.equinox.p2.director \ |
| -noSplash \ |
| -repository \ |
| http://download.eclipse.org/papyrus-rt/builds/repository,http://download.eclipse.org/releases/mars,http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/mars,https://hudson.eclipse.org/papyrus-rt/job/Papyrus-RT-Master-All/lastSuccessfulBuild/artifact/repository \ |
| -installIUs \ |
| org.eclipse.papyrusrt.codegen-feature.feature.group,org.eclipse.papyrusrt.rts-feature.feature.group,org.eclipse.papyrusrt.umlrt.profile.feature.feature.group |
| |
| echo "* Install done " |
| |
| |
| if [ $? -ne 0 ]; then |
| echo "* Unable to install $BUILD_ID" |
| exit 1 |
| fi |
| |
| echo "* Installed $BUILD_ID" |
| |
| echo "* Cloning test models" |
| |
| git clone git://git.eclipse.org/gitroot/papyrus-rt/org.eclipse.papyrus-rt.git $src_dir/org.eclipse.papyrus-rt |
| #ls -Ral $src_dir/org.eclipse.papyrus-rt |
| |
| |
| standalone_dir=$install_dir/eclipse/plugins/org.eclipse.papyrusrt.codegen.standalone_* |
| #ls -al $standalone_dir |
| |
| # The generation script needs a folder for the development plugins. We don't |
| # want any here, so create a dummy folder. |
| mkdir -p /tmp/empty |
| |
| mkdir -p $ws_dir |
| |
| echo "* Generating code for test model" |
| |
| ls -al $src_dir/org.eclipse.papyrus-rt/models/$repodir |
| |
| chmod +x $standalone_dir/umlrtgen.sh |
| $standalone_dir/umlrtgen.sh \ |
| $install_dir/eclipse/plugins \ |
| /tmp/empty \ |
| java \ |
| $EXTRAOPTS -s -o $ws_dir/$modelname \ |
| $src_dir/org.eclipse.papyrus-rt/models/$repodir/$modelname/$modelname.uml |
| |
| |
| rc=$? |
| if [ $rc -ne 0 ]; then |
| echo "* Unable to generate code for $modelname, generator completed with $rc" |
| exit 1 |
| fi |
| |
| echo "* Code generated successfully" |
| |
| cd $ws_dir/$modelname/src |
| |
| echo "* Running 'make' on generated source" |
| |
| export UMLRTS_ROOT=`echo $install_dir/eclipse/plugins/org.eclipse.papyrusrt.rts_*/umlrts` |
| make TARGETOS=linux BUILDTOOLS=x86-gcc-4.6.3 |
| |
| if [ $? -ne 0 ]; then |
| echo "* Unable to build executable for $modelname" |
| mail -s sredding@zeligsoft.com "$modelname $BUILDTYPE build failed" < /dev/null |
| exit 1 |
| fi |
| |
| echo "* Compiled generated sources successfully" |
| |
| echo "* Executing model" |
| |
| time ./$TOPNAME |
| rc=$? |
| if [ $rc -ne 0 ]; then |
| echo "* Unable to execute $modelname, exited with $rc" |
| mail sredding@zeligsoft.com -s "$modelname $BUILDTYPE build failed" < /dev/null |
| exit 1 |
| fi |
| |
| echo "* Removing temporary work dirs" |
| cd $build_dir |
| rm -rf autotest.$BUILD_ID.install |
| rm -rf autotest.$BUILD_ID.src |
| rm -rf autotest.$BUILD_ID.ws |
| echo "* Successfully built and ran $modelname" |
| echo "* Send sucess email" |
| mail sredding@zeligsoft.com -s "$modelname $BUILDTYPE build passed" < /dev/null |
| exit 0 |
| |