2 # Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 import multiprocessing
27 def unwrap_self_session(arg, **kwarg):
28 return TestConcurrentLaunch.session(*arg, **kwarg)
31 class TestConcurrentLaunch(unittest.TestCase):
34 # Initialize path to SALOME application
35 path_to_launcher = os.getenv("SALOME_LAUNCHER")
36 appli_dir = os.path.dirname(path_to_launcher)
37 cls.envd_dir = os.path.join(appli_dir, "env.d")
39 # Configure session startup
40 cls.SALOME = imp.load_source("SALOME", os.path.join(appli_dir,"salome"))
41 #cls.SALOME_args = ["shell", "--config="+cls.envd_dir]
42 cls.SALOME_args = ["--config="+cls.envd_dir]
45 def tearDownClass(cls):
46 args = ["killall", "--config="+cls.envd_dir]
50 def session(self, args=[]):
51 self.SALOME.main(self.SALOME_args + args)
53 def test01_SingleSession(self):
54 print "** Testing single session **"
57 def test02_MultiSession(self):
58 print "** Testing multi sessions **"
62 p = multiprocessing.Process(target=unwrap_self_session, args=([self],))
72 if __name__ == "__main__":
73 path_to_launcher = os.getenv("SALOME_LAUNCHER")
74 if not path_to_launcher:
75 msg = "Error: please set SALOME_LAUNCHER variable to the salome command of your application folder."