Salome HOME
PR: merge from branch BR_UT_V310a3 tag mergeto_trunk_05dec05
[modules/kernel.git] / bin / appliskel / runTests
1 #!/bin/bash
2
3 # --- retrieve APPLI path, relative to $HOME, set ${APPLI}
4
5 . `dirname $0`/setAppliPath.sh
6
7 # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
8
9 . ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
10
11 # --- define port for CORBA naming service
12
13 searchFreePort() {
14     echo -n "Searching for a free port for naming service: "
15     export NSPORT=2810
16     local limit=$NSPORT
17     let limit=limit+100
18     while [ 1 ]
19     do
20         aRes=`netstat -ltn | grep -E :${NSPORT}`
21         if [ -z "$aRes" ]; then
22             echo ${NSPORT} - Ok
23             local myhost=`hostname`
24             export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_${NSPORT}.cfg
25             export NSPORT
26             export NSHOST=${myhost}
27             local initref="NameService=corbaname::"`hostname`":$NSPORT"
28             #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
29             echo "InitRef = $initref" > $OMNIORB_CONFIG
30             export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_test.cfg
31             rm ${LAST_RUNNING_CONFIG}
32             ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
33             break
34         fi
35         echo -n "${NSPORT} "
36         if [[ $NSPORT -eq $limit ]] ; then
37             echo
38             echo "Can't find a free port to launch omniNames"
39             echo "Try to kill the running servers and then launch SALOME again."
40             exit
41         fi
42         let NSPORT=NSPORT+1
43     done
44 }
45
46 # --- if mpi lam, start lam (seems safe to be done several times)
47 #     arret manuel avec lamhalt
48
49 if [ "$LAMBHOST" ]; then
50   lamboot
51 fi
52
53 # --- invoque shell with or without args
54
55 searchFreePort
56
57 if [ $# -ne 0 ] ; then
58     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
59 else
60
61     ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
62 fi
63
64 rm ${OMNIORB_CONFIG}
65 rm ${LAST_RUNNING_CONFIG}