]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Crash of tests on Windows BR_PPGP_BETA1
authorvtn <vtn@opencascade.com>
Mon, 1 Apr 2013 13:34:10 +0000 (13:34 +0000)
committervtn <vtn@opencascade.com>
Mon, 1 Apr 2013 13:34:10 +0000 (13:34 +0000)
bin/killSalomeWithPort.py
bin/salome_utils.py
bin/shutdownSalome.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx

index a8a046904547ae7953de6f79b0d4edcf4a9a38f7..174fb00f3aa97d9f63f88a8d0a6cdcb66e526e28 100755 (executable)
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -93,7 +93,7 @@ def appliCleanOmniOrbConfig(port):
         #Run outside application context
         pass
     else:
-        dir = os.path.join(home, appli,"USERS")
+        dir = os.path.join(os.path.realpath(home), appli,"USERS")
         omniorb_config      = generateFileName(dir, prefix="omniORB",
                                                extension="cfg",
                                                hidden=True,
@@ -117,7 +117,7 @@ def appliCleanOmniOrbConfig(port):
             os.remove(omniorb_config)
             pass
 
-        if os.path.lexists(last_running_config):return 
+        if os.path.lexists(last_running_config):return
 
         #try to relink last.cfg to an existing config file if any
         files = glob.glob(os.path.join(os.environ["HOME"],Utils_Identity.getapplipath(),
@@ -137,22 +137,22 @@ def appliCleanOmniOrbConfig(port):
 
 ########## kills all salome processes with the given port ##########
 
-def shutdownMyPort(port):
+def shutdownMyPort(port, cleanup=True):
     """
     Shutdown SALOME session running on the specified port.
     Parameters:
     - port - port number
     """
     if not port: return
-    
+
     from salome_utils import generateFileName
 
     # set OMNIORB_CONFIG variable to the proper file
     home  = os.getenv("HOME")
     appli = os.getenv("APPLI")
     kwargs = {}
-    if appli is not None: 
-        home = os.path.join(home, appli,"USERS")
+    if appli is not None:
+        home = os.path.join(os.path.realpath(home), appli,"USERS")
         kwargs["with_username"]=True
         pass
     omniorb_config = generateFileName(home, prefix="omniORB",
@@ -162,22 +162,29 @@ def shutdownMyPort(port):
                                       with_port=port,
                                       **kwargs)
     os.environ['OMNIORB_CONFIG'] = omniorb_config
+    os.environ['NSPORT'] = str(port)
 
     # give the chance to the servers to shutdown properly
     try:
         import time
-        import salome_kernel
-        orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+        from omniORB import CORBA
+        from LifeCycleCORBA import LifeCycleCORBA
         # shutdown all
+        orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+        lcc = LifeCycleCORBA(orb)
         lcc.shutdownServers()
         # give some time to shutdown to complete
         time.sleep(1)
         # shutdown omniNames and notifd
-        salome_kernel.LifeCycleCORBA.killOmniNames()
+        if cleanup:
+            lcc.killOmniNames()
+            time.sleep(1)
+            pass
+        pass
     except:
         pass
     pass
-    
+
 def killMyPort(port):
     """
     Kill SALOME session running on the specified port.
@@ -185,12 +192,12 @@ def killMyPort(port):
     - port - port number
     """
     from salome_utils import getShortHostName, getHostName
-    
+
     # try to shutdown session nomally
     import threading, time
-    threading.Thread(target=shutdownMyPort, args=(port,)).start()
+    threading.Thread(target=shutdownMyPort, args=(port,False)).start()
     time.sleep(3) # wait a little, then kill processes (should be done if shutdown procedure hangs up)
-    
+
     # new-style dot-prefixed pidict file
     filedict = getPiDict(port, hidden=True)
     # provide compatibility with old-style pidict file (not dot-prefixed)
@@ -218,7 +225,7 @@ def killMyPort(port):
                                          suffix="Pid_omniNames",
                                          extension="log",
                                          with_port=port)
-        if not sys.platform == 'win32':        
+        if not sys.platform == 'win32':
             cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start %s"` ; echo $pid > %s' % ( str(port), fpidomniNames )
             a = os.system(cmd)
             pass
@@ -255,7 +262,7 @@ def killMyPort(port):
                     try:
                         if sys.platform == "win32":
                             import win32pm
-                            win32pm.killpid(int(pid),0)                            
+                            win32pm.killpid(int(pid),0)
                         else:
                             os.kill(int(pid),signal.SIGKILL)
                             pass
@@ -285,7 +292,7 @@ def killMyPort(port):
     #
     appliCleanOmniOrbConfig(port)
     pass
-            
+
 def killNotifdAndClean(port):
     """
     Kill notifd daemon and clean application running on the specified port.
@@ -355,10 +362,19 @@ def killMyPortSpy(pid, port):
     return
 
 if __name__ == "__main__":
+    if len(sys.argv) < 2:
+        print "Usage: "
+        print "  %s <port>" % os.path.basename(sys.argv[0])
+        print
+        print "Kills SALOME session running on specified <port>."
+        sys.exit(1)
+        pass
     if sys.argv[1] == "--spy":
-        pid = sys.argv[2]
-        port = sys.argv[3]
-        killMyPortSpy(pid, port)
+        if len(sys.argv) > 3:
+            pid = sys.argv[2]
+            port = sys.argv[3]
+            killMyPortSpy(pid, port)
+            pass
         sys.exit(0)
         pass
     for port in sys.argv[1:]:
index 95e87f42cfdbc871f708f0014f1320c4abf10384..dc79fb1c6774fe1976c214eb52726ad7d8f180b6 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -194,8 +194,11 @@ def getPortNumber(use_default=True):
         return int( os.getenv( "NSPORT" ) )
     except:
         pass
-    port = getPortFromORBcfg()
-    if port is not None: return port
+    try:
+        port = int( getPortFromORBcfg() )
+        if port is not None: return port
+    except:
+        pass
     if use_default: return 2809 # '2809' is default port number
     return None
 
index b7d319696acc7f3926d1cb1e033554689291eb03..e4425e3152e5d2df599883dfcfed5c6dd1e5a124 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #
 
 import time
-import salome_kernel
-orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+from omniORB import CORBA
+from LifeCycleCORBA import *
+
+orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+lcc = LifeCycleCORBA(orb)
 lcc.shutdownServers()
-#give some time to shutdown to complete
 time.sleep(1)
-salome_kernel.LifeCycleCORBA.killOmniNames()
+LifeCycleCORBA.killOmniNames()
+time.sleep(1)
index 2afca3b7f4efe1a69ded3a74b3be8f59e249f54f..afd7e6f6315a921882ed94678b39af9c6d247922 100644 (file)
@@ -550,6 +550,7 @@ void SALOME_LifeCycleCORBA::shutdownServers()
     if (!CORBA::is_nil(session))
     {
       pid = session->getPID();
+      session->Shutdown();
     }
   }
 
@@ -644,6 +645,7 @@ void SALOME_LifeCycleCORBA::shutdownServers()
        // ignore and continue
     }
 
+  /*
   // 6) Session
   if ( !CORBA::is_nil( session ) ) {
     try
@@ -655,6 +657,7 @@ void SALOME_LifeCycleCORBA::shutdownServers()
       // ignore and continue
     }
   }
+  */
 
   // 7) Logger
   int argc = 0;