IF(NOT SALOME_LIGHT_ONLY)
FIND_PACKAGE(SalomeOmniORB REQUIRED)
FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
-ENDIF()
+ENDIF()
IF(SALOME_USE_MPI)
FIND_PACKAGE(SalomeMPI REQUIRED)
IF(HDF5_IS_PARALLEL)
IF(SALOME_BUILD_TESTS)
ENABLE_TESTING()
FIND_PACKAGE(SalomeCppUnit)
- SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
+ SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
ENDIF()
IF(SALOME_BUILD_DOC)
FIND_PACKAGE(SalomeDoxygen)
SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs")
SET(SALOME_INSTALL_IDLS idl/salome CACHE PATH "Install path: SALOME IDL files")
SET(SALOME_INSTALL_HEADERS include/salome CACHE PATH "Install path: SALOME headers")
-SET(SALOME_INSTALL_SCRIPT_SCRIPTS ${SALOME_INSTALL_BINS} CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_SCRIPTS ${SALOME_INSTALL_BINS} CACHE PATH
"Install path: SALOME scripts")
-SET(SALOME_INSTALL_SCRIPT_DATA ${SALOME_INSTALL_BINS} CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_DATA ${SALOME_INSTALL_BINS} CACHE PATH
"Install path: SALOME script data")
-SET(SALOME_INSTALL_SCRIPT_PYTHON ${SALOME_INSTALL_BINS} CACHE PATH
+SET(SALOME_INSTALL_SCRIPT_PYTHON ${SALOME_INSTALL_BINS} CACHE PATH
"Install path: SALOME Python scripts")
-SET(SALOME_INSTALL_APPLISKEL_SCRIPTS ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
+SET(SALOME_INSTALL_APPLISKEL_SCRIPTS ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
"Install path: SALOME application skeleton - scripts")
-SET(SALOME_INSTALL_APPLISKEL_PYTHON ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
+SET(SALOME_INSTALL_APPLISKEL_PYTHON ${SALOME_INSTALL_BINS}/appliskel CACHE PATH
"Install path: SALOME application skeleton - Python")
SET(SALOME_INSTALL_CMAKE salome_adm/cmake_files CACHE PATH "Install path: SALOME CMake files")
-SET(SALOME_INSTALL_CMAKE_LOCAL adm_local/cmake_files CACHE PATH
+SET(SALOME_INSTALL_CMAKE_LOCAL adm_local/cmake_files CACHE PATH
"Install path: local SALOME CMake files")
-SET(SALOME_INSTALL_AMCONFIG salome_adm/unix CACHE PATH
+SET(SALOME_INSTALL_AMCONFIG salome_adm/unix CACHE PATH
"Install path: SALOME config files (obsolete, to be removed)")
-SET(SALOME_INSTALL_AMCONFIG_LOCAL adm_local/unix CACHE PATH
+SET(SALOME_INSTALL_AMCONFIG_LOCAL adm_local/unix CACHE PATH
"Install path: local SALOME config files (obsolete, to be removed)")
SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
SET(SALOME_INSTALL_PYTHON ${_pydir}/salome CACHE PATH "Install path: SALOME Python stuff")
-SET(SALOME_INSTALL_PYTHON_SHARED ${SALOME_INSTALL_PYTHON}/shared_modules CACHE PATH
+SET(SALOME_INSTALL_PYTHON_SHARED ${SALOME_INSTALL_PYTHON}/shared_modules CACHE PATH
"Install path: SALOME Python shared modules")
SET(SALOME_INSTALL_RES share/salome/resources CACHE PATH "Install path: SALOME resources")
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED})
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
-# Sources
+# For salome test
+SET(KERNEL_TEST_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+SET(KERNEL_TEST_LIB ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/lib)
+CONFIGURE_FILE(CTestTestfileInstall.cmake.in CTestTestfileInstall.cmake @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake
+ DESTINATION ${KERNEL_TEST_DIR}
+ RENAME CTestTestfile.cmake)
+
+# Sources
# ========
IF(NOT SALOME_LIGHT_ONLY)
ADD_SUBDIRECTORY(idl)
# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
-SET(_${PROJECT_NAME}_exposed_targets
+SET(_${PROJECT_NAME}_exposed_targets
SALOMEBasics SALOMELocalTrace SalomeHDFPersist OpUtil)
-
+
# CORBA specific targets:
IF(NOT SALOME_LIGHT_ONLY)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- DF SalomeLoggerServer with_loggerTraceCollector SalomeNS SalomeGenericObj
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ DF SalomeLoggerServer with_loggerTraceCollector SalomeNS SalomeGenericObj
Registry SalomeCatalog ResourcesManager SalomeResourcesManager
SalomeNotification SalomeContainer SalomeSDS Launcher SalomeLauncher
SalomeLifeCycleCORBA SalomeDSClient TOOLSDS SalomeKernelHelpers
SalomeDSImpl SalomeDS SalomeCommunication SalomeDSCContainer)
# Temporary solution for package src\DSC on windows
IF(NOT WIN32)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- CalciumC SalomeCalcium SalomeDatastream SalomePalm SalomeDSCSupervBasic
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ CalciumC SalomeCalcium SalomeDatastream SalomePalm SalomeDSCSupervBasic
SalomeDSCSuperv)
IF(SALOME_PACO_PARALLEL)
LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelDSCContainer)
ENDIF()
ENDIF()
ENDIF()
-
+
# MPI specific targets:
IF(SALOME_USE_MPI)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
SalomeMPIContainer SalomeTestMPIComponentEngine)
ENDIF()
-
+
# Test targets:
IF(SALOME_BUILD_TESTS)
LIST(APPEND _${PROJECT_NAME}_exposed_targets SALOMELocalTraceTest UnitTests)
IF(NOT SALOME_LIGHT_ONLY)
- LIST(APPEND _${PROJECT_NAME}_exposed_targets
- SALOMETraceCollectorTest UtilsTest NamingServiceTest SalomeTestComponentEngine
+ LIST(APPEND _${PROJECT_NAME}_exposed_targets
+ SALOMETraceCollectorTest UtilsTest NamingServiceTest SalomeTestComponentEngine
LifeCycleCORBATest SalomeKernelHelpersTest SALOMEDSImplTest SALOMEDSTest)
ENDIF()
ENDIF()
IF(SALOME_PACO_PARALLEL)
LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelContainer)
ENDIF()
-
+
IF(NOT SALOME_LIGHT_ONLY)
LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeIDLKernel)
IF(SALOME_PACO_PARALLEL)
LIST(APPEND _${PROJECT_NAME}_exposed_targets SalomeParallelIDLKernel)
ENDIF()
ENDIF()
-
+
# Add all targets to the build-tree export set
EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(CppUnit Graphviz Doxygen Sphinx MPI omniORB LibBatch
+SALOME_CONFIGURE_PREPARE(CppUnit Graphviz Doxygen Sphinx MPI omniORB LibBatch
PThread Boost HDF5 libXml2 Python SimanIO)
-CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
+CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
PYTHON_ROOT_DIR SWIG_ROOT_DIR)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
-# Get the relative path of the include directory so
+# Get the relative path of the include directory so
# we can register it in the generated configuration files:
#SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
-#CONFIGURE_PACKAGE_CONFIG_FILE(salome_adm/cmake_files/${PROJECT_NAME}Config.cmake.in
+#CONFIGURE_PACKAGE_CONFIG_FILE(salome_adm/cmake_files/${PROJECT_NAME}Config.cmake.in
# ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
# INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE}"
-# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
+# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE CMAKE_INSTALL_PREFIX
# CPPUNIT_ROOT_DIR GRAPHVIZ_ROOT_DIR DOXYGEN_ROOT_DIR
# SPHINX_ROOT_DIR MPI_ROOT_DIR OMNIORB_ROOT_DIR OMNIORBPY_ROOT_DIR LIBBATCH_ROOT_DIR
# SIMANIO_ROOT_DIR PTHREAD_ROOT_DIR BOOST_ROOT_DIR HDF5_ROOT_DIR LIBXML2_ROOT_DIR
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME_UC}_VERSION}
COMPATIBILITY AnyNewerVersion)
-
+
# Install the CMake configuration files:
INSTALL(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
DESTINATION "${SALOME_INSTALL_CMAKE}")
# Install the export set for use with the install-tree
-INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE}"
+INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE}"
FILE ${PROJECT_NAME}Targets.cmake)
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+#SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
+SET(SALOME_TEST_DRIVER "@CMAKE_INSTALL_PREFIX@/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME KERNEL)
+SET(TIMEOUT 500)
+
+SET(KERNEL_TEST_LIB "@CMAKE_INSTALL_PREFIX@/@KERNEL_TEST_LIB@")
+
+# Add all test subdirs
+SUBDIRS( Launcher
+ LifeCycleCORBA_SWIG
+ NamingService
+ SALOMELocalTrace
+ LifeCycleCORBA
+ Logger
+ SALOMETraceCollector
+ KernelHelpers
+ SALOMEDS
+ SALOMEDSImpl
+ Utils
+ UnitTests
+ connect
+ )
#
def stop(self):
- import killSalomeWithPort
- killSalomeWithPort.killMyPort(self.port)
+ from multiprocessing import Process
+ from killSalomeWithPort import killMyPort
+ import tempfile
+ with tempfile.NamedTemporaryFile():
+ p = Process(target = killMyPort, args=(self.port,))
+ p.start()
+ p.join()
+ pass
#
#
#
ADD_SUBDIRECTORY(concurrentSession)
+ADD_SUBDIRECTORY(connect)
ADD_SUBDIRECTORY(launcher)
--- /dev/null
+# Copyright (C) 2013-2015 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+FILE(GLOB py_scripts "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
+
+LIST(APPEND scripts ${py_scripts})
+
+# Application tests
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${KERNEL_TEST_DIR}/connect
+ RENAME CTestTestfile.cmake)
+
+INSTALL(FILES ${scripts}
+ DESTINATION ${KERNEL_TEST_DIR}/connect)
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(TEST_NAMES instances)
+
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME CONNECT_${tfile})
+ ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+ENDFOREACH()
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import unittest
+import multiprocessing
+
+def new_instance(running_instances):
+ from salome_instance import SalomeInstance
+ instance = SalomeInstance.start()
+ print "Instance created and now running on port", instance.get_port()
+ running_instances.put(instance)
+#
+
+class TestLauncher(unittest.TestCase):
+
+ def __createInstances(self, nb):
+ running_instances = multiprocessing.Queue()
+ processes = [
+ multiprocessing.Process(target=new_instance, args=(running_instances,))
+ for i in range(nb)
+ ]
+ return running_instances, processes
+ #
+
+ def __terminateInstances(self, running_instances):
+ while not running_instances.empty():
+ instance = running_instances.get()
+ print "Terminate instance running on port", instance.get_port()
+ instance.stop()
+ #
+
+ def __connectToInstance(self, port):
+ import setenv
+ setenv.main(True)
+ import runConsole
+ return runConsole.connect(["-p", port, "-c", "exit()"]) # auto-logout
+ #
+
+ def testSequential(self):
+ running_instances, processes = self.__createInstances(3)
+ for p in processes:
+ p.start()
+ p.join()
+ pass
+
+ self.__terminateInstances(running_instances)
+ #
+
+ def testConcurrent(self):
+ running_instances, processes = self.__createInstances(5)
+ for p in processes:
+ p.start()
+ pass
+ for p in processes:
+ p.join()
+ pass
+
+ self.__terminateInstances(running_instances)
+ #
+
+ def testConnectInstance(self):
+ # Create some instances
+ running_instances, processes = self.__createInstances(5)
+ for p in processes:
+ p.start()
+ pass
+ for p in processes:
+ p.join()
+ pass
+
+ # move queued instances to a list
+ all_instances = []
+ while not running_instances.empty():
+ all_instances.append(running_instances.get())
+
+ # Connect to one instance
+ import runConsole
+ port = all_instances[len(all_instances)/2].get_port()
+ print "Connect to instance running on port", port
+ self.__connectToInstance(port)
+
+ # Connect to another instance
+ import runConsole
+ port = all_instances[len(all_instances)/4].get_port()
+ print "Connect to instance running on port", port
+ self.__connectToInstance(port)
+
+ # Terminate instances
+ for instance in all_instances:
+ print "Terminate instance running on port", instance.get_port()
+ instance.stop()
+ #
+
+if __name__ == "__main__":
+ unittest.main()
+#
host, port, filename = None, None, None
if requested_port:
print "Search for running instance on port %s..."%requested_port
- found = [(h,p,f) for h,p,f in available_connexions if p == requested_port]
+ found = [(h,p,f) for h,p,f in available_connexions if int(p) == int(requested_port)]
if not found:
print " ...no running instance found"
elif len(found) == 1:
#
def start_client():
- print os.getenv("OMNIORB_CONFIG")
-
try:
clt = client()
except Exception:
LIST(APPEND SUBDIRS ${SUBDIR_PARALLEL})
ENDIF()
-# For salome test
-SET(KERNEL_TEST_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
-SET(KERNEL_TEST_LIB ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/lib)
-CONFIGURE_FILE(CTestTestfileInstall.cmake.in CTestTestfileInstall.cmake @ONLY)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake
- DESTINATION ${KERNEL_TEST_DIR}
- RENAME CTestTestfile.cmake)
-
FOREACH(_dir ${SUBDIRS})
ADD_SUBDIRECTORY(${_dir})
ENDFOREACH()
+++ /dev/null
-# Copyright (C) 2015 CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-#SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
-SET(SALOME_TEST_DRIVER "@CMAKE_INSTALL_PREFIX@/bin/salome/appliskel/salome_test_driver.py")
-
-SET(COMPONENT_NAME KERNEL)
-SET(TIMEOUT 500)
-
-SET(KERNEL_TEST_LIB "@CMAKE_INSTALL_PREFIX@/@KERNEL_TEST_LIB@")
-
-# Add all test subdirs
-SUBDIRS( Launcher
- LifeCycleCORBA_SWIG
- NamingService
- SALOMELocalTrace
- LifeCycleCORBA
- Logger
- SALOMETraceCollector
- KernelHelpers
- SALOMEDS
- SALOMEDSImpl
- Utils
- UnitTests
- )