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