From 33ee943ca85cd0535d01f42e832b9ec855292b52 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 5 Oct 2005 10:04:12 +0000 Subject: [PATCH] PR: script to set SALOME environment for unit tests --- bin/appliskel/runAppli | 6 ++-- bin/appliskel/runSession | 3 +- bin/appliskel/runTests | 69 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) create mode 100755 bin/appliskel/runTests diff --git a/bin/appliskel/runAppli b/bin/appliskel/runAppli index 05b0287d1..590947e82 100755 --- a/bin/appliskel/runAppli +++ b/bin/appliskel/runAppli @@ -36,8 +36,9 @@ searchFreePort() { export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg export NSPORT local initref="NameService=corbaname::"`hostname`":$NSPORT" - echo "ORBInitRef $initref" > $OMNIORB_CONFIG - LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + #echo "ORBInitRef $initref" > $OMNIORB_CONFIG + echo "InitRef = $initref" > $OMNIORB_CONFIG + export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg rm ${LAST_RUNNING_CONFIG} ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} break @@ -66,3 +67,4 @@ else fi rm ${OMNIORB_CONFIG} +rm ${LAST_RUNNING_CONFIG} diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index a2c9d4b45..2ab579ce6 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -18,7 +18,7 @@ else mycom=${PWD}/${comName} fi APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '` -#echo $APPLI +echo $APPLI export APPLI # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) @@ -33,5 +33,6 @@ export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg if [ $# -ne 0 ] ; then ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*" else + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc fi diff --git a/bin/appliskel/runTests b/bin/appliskel/runTests new file mode 100755 index 000000000..ac202508d --- /dev/null +++ b/bin/appliskel/runTests @@ -0,0 +1,69 @@ +#!/bin/bash + +# --- retrieve APPLI path, relative to $HOME +# on sarge, "which" gives not allways the absolute path... + +comName=`which $0` +aa=${comName:0:1} +if test x$aa == x\/; then + mycom=${comName} +elif test x$aa == x\.; then + mycom=${PWD}/${comName:2} +else + mycom=${PWD}/${comName} +fi +APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '` +#echo $APPLI +export APPLI + +# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) + +. ${HOME}/${APPLI}/envd ${HOME}/${APPLI} + +# --- define port for CORBA naming service + +searchFreePort() { + echo -n "Searching for a free port for naming service: " + export NSPORT=2810 + local limit=$NSPORT + let limit=limit+100 + while [ 1 ] + do + aRes=`netstat -ltn | grep -E :${NSPORT}` + if [ -z "$aRes" ]; then + echo ${NSPORT} - Ok + local myhost=`hostname` + export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg + export NSPORT + local initref="NameService=corbaname::"`hostname`":$NSPORT" + #echo "ORBInitRef $initref" > $OMNIORB_CONFIG + echo "InitRef = $initref" > $OMNIORB_CONFIG + export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_test.cfg + rm ${LAST_RUNNING_CONFIG} + ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} + break + fi + echo -n "${NSPORT} " + if [[ $NSPORT -eq $limit ]] ; then + echo + echo "Can't find a free port to launch omniNames" + echo "Try to kill the running servers and then launch SALOME again." + exit + fi + let NSPORT=NSPORT+1 + done +} + +# --- invoque shell with or without args + +searchFreePort + +if [ $# -ne 0 ] ; then + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*" +else + + ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc +fi + +rm ${OMNIORB_CONFIG} +rm ${LAST_RUNNING_CONFIG} -- 2.39.2