]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: script to set SALOME environment for unit tests
authorprascle <prascle>
Wed, 5 Oct 2005 10:04:12 +0000 (10:04 +0000)
committerprascle <prascle>
Wed, 5 Oct 2005 10:04:12 +0000 (10:04 +0000)
bin/appliskel/runAppli
bin/appliskel/runSession
bin/appliskel/runTests [new file with mode: 0755]

index 05b0287d1ef5229c6dbcc9551835e6b6a62c7414..590947e822e53178c38c4da1921bf15d5ea4e192 100755 (executable)
@@ -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}
index a2c9d4b4593e7ecfb2ccdac07940db5dc1e6af02..2ab579ce6d80091da99e6d26e688f40944089969 100755 (executable)
@@ -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 (executable)
index 0000000..ac20250
--- /dev/null
@@ -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}