From 3fef308df1b7c083d9b59f2f772c4b533716499a Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Wed, 11 Mar 2015 15:20:35 +0100 Subject: [PATCH] CppUnit tests updated to the new test procedure based on salome_test_driver. --- .../salome_tester/salome_test_driver.py | 3 +- src/CMakeLists.txt | 10 ++++- src/CTestTestfileInstall.cmake.in | 41 +++++++++++++++++++ src/KernelHelpers/Test/CMakeLists.txt | 14 +++++-- .../Test/CTestTestfileInstall.cmake | 30 ++++++++++++++ src/KernelHelpers/Test/TestKernelHelpers.py | 8 ++-- src/Launcher/Test/CMakeLists.txt | 4 +- src/Launcher/Test/CTestTestfileInstall.cmake | 5 --- src/LifeCycleCORBA/Test/CMakeLists.txt | 13 ++++-- .../Test/CTestTestfileInstall.cmake | 26 ++++++++++++ src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py | 3 +- .../Test/CTestTestfileInstall.cmake | 28 +++++++++++++ .../Test/TestLifeCycleCORBA_SWIG.py | 1 + src/Logger/Test/TestKiller.py | 10 +++-- src/NamingService/Test/CMakeLists.txt | 13 ++++-- .../Test/CTestTestfileInstall.cmake | 27 ++++++++++++ src/NamingService/Test/TestNamingService.py | 3 +- src/SALOMEDS/Test/CMakeLists.txt | 13 ++++-- src/SALOMEDS/Test/CTestTestfileInstall.cmake | 26 ++++++++++++ src/SALOMEDS/Test/TestSALOMEDS.py | 8 ++-- src/SALOMEDSImpl/Test/CMakeLists.txt | 13 ++++-- .../Test/CTestTestfileInstall.cmake | 26 ++++++++++++ src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py | 8 ++-- src/SALOMELocalTrace/Test/CMakeLists.txt | 13 ++++-- .../Test/CTestTestfileInstall.cmake | 26 ++++++++++++ .../Test/TestSALOMELocalTrace.py | 3 +- src/SALOMETraceCollector/Test/CMakeLists.txt | 13 ++++-- .../Test/CTestTestfileInstall.cmake | 26 ++++++++++++ .../Test/TestSALOMETraceCollector.py | 8 ++-- src/UnitTests/CMakeLists.txt | 9 +++- src/UnitTests/CTestTestfileInstall.cmake | 27 ++++++++++++ src/UnitTests/UnitTests.py | 3 +- src/Utils/Test/CMakeLists.txt | 13 ++++-- src/Utils/Test/CTestTestfileInstall.cmake | 26 ++++++++++++ src/Utils/Test/TestUtils.py | 8 ++-- 35 files changed, 443 insertions(+), 65 deletions(-) create mode 100644 src/CTestTestfileInstall.cmake.in create mode 100644 src/KernelHelpers/Test/CTestTestfileInstall.cmake create mode 100644 src/LifeCycleCORBA/Test/CTestTestfileInstall.cmake create mode 100644 src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake create mode 100644 src/NamingService/Test/CTestTestfileInstall.cmake create mode 100644 src/SALOMEDS/Test/CTestTestfileInstall.cmake create mode 100644 src/SALOMEDSImpl/Test/CTestTestfileInstall.cmake create mode 100644 src/SALOMELocalTrace/Test/CTestTestfileInstall.cmake create mode 100644 src/SALOMETraceCollector/Test/CTestTestfileInstall.cmake create mode 100644 src/UnitTests/CTestTestfileInstall.cmake create mode 100644 src/Utils/Test/CTestTestfileInstall.cmake diff --git a/bin/appliskel/salome_tester/salome_test_driver.py b/bin/appliskel/salome_tester/salome_test_driver.py index b73673663..2587881ce 100644 --- a/bin/appliskel/salome_tester/salome_test_driver.py +++ b/bin/appliskel/salome_tester/salome_test_driver.py @@ -61,7 +61,8 @@ if __name__ == "__main__": # Add explicit call to python executable if a Python script is passed as # first argument if not args: - exit(0) + print "Invalid arguments for salome_test_helper.py. No command defined." + exit(1) _, ext = os.path.splitext(args[0]) if ext == ".py": test_and_args = [sys.executable] + args diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 76ee1e618..0303f3840 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,6 +99,14 @@ ELSE() ENDIF() 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() +ENDFOREACH() \ No newline at end of file diff --git a/src/CTestTestfileInstall.cmake.in b/src/CTestTestfileInstall.cmake.in new file mode 100644 index 000000000..97f990c0d --- /dev/null +++ b/src/CTestTestfileInstall.cmake.in @@ -0,0 +1,41 @@ +# 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 + ) diff --git a/src/KernelHelpers/Test/CMakeLists.txt b/src/KernelHelpers/Test/CMakeLists.txt index 3784df24f..3c228fef0 100755 --- a/src/KernelHelpers/Test/CMakeLists.txt +++ b/src/KernelHelpers/Test/CMakeLists.txt @@ -52,17 +52,23 @@ SET(SalomeKernelHelpersTest_LIBS ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/KernelHelpers) + ADD_LIBRARY(SalomeKernelHelpersTest KernelHelpersUnitTests.cxx) TARGET_LINK_LIBRARIES(SalomeKernelHelpersTest ${SalomeKernelHelpersTest_LIBS}) -INSTALL(TARGETS SalomeKernelHelpersTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS SalomeKernelHelpersTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestKernelHelpers TestKernelHelpers.cxx) TARGET_LINK_LIBRARIES(TestKernelHelpers SalomeKernelHelpersTest ${SalomeKernelHelpersTest_LIBS}) #ADD_TEST(TestKernelHelpers TestKernelHelpers) -INSTALL(TARGETS TestKernelHelpers DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestKernelHelpers DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestKernelHelpers.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestKernelHelpers.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) diff --git a/src/KernelHelpers/Test/CTestTestfileInstall.cmake b/src/KernelHelpers/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..73508ea16 --- /dev/null +++ b/src/KernelHelpers/Test/CTestTestfileInstall.cmake @@ -0,0 +1,30 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(KernelHelpers python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestKernelHelpers.py) + SET_TESTS_PROPERTIES(KernelHelpers PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + # TIMEOUT 500 + ) + # /!\ DO NOT SET TIMEOUT PROPERTY IF USING ${SALOME_TEST_DRIVER} + # BUT PASS TIMEOUT VALUE TO THE DRIVER + +ENDIF() diff --git a/src/KernelHelpers/Test/TestKernelHelpers.py b/src/KernelHelpers/Test/TestKernelHelpers.py index 42ead6088..e9fd1347a 100644 --- a/src/KernelHelpers/Test/TestKernelHelpers.py +++ b/src/KernelHelpers/Test/TestKernelHelpers.py @@ -25,11 +25,12 @@ import sys, os,signal,string,commands import runSalome import orbmodule import TestKiller +import setenv # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server @@ -43,9 +44,10 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestKernelHelpers'] +command = ['./TestKernelHelpers'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) diff --git a/src/Launcher/Test/CMakeLists.txt b/src/Launcher/Test/CMakeLists.txt index d77c657be..6cb719fce 100644 --- a/src/Launcher/Test/CMakeLists.txt +++ b/src/Launcher/Test/CMakeLists.txt @@ -28,9 +28,9 @@ IF(NOT WIN32) # -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} # ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_launcher.py - DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test) + DESTINATION ${KERNEL_TEST_DIR}/Launcher) INSTALL(FILES CTestTestfileInstall.cmake - DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test + DESTINATION ${KERNEL_TEST_DIR}/Launcher RENAME CTestTestfile.cmake) ENDIF() diff --git a/src/Launcher/Test/CTestTestfileInstall.cmake b/src/Launcher/Test/CTestTestfileInstall.cmake index d43734d8f..311467a5a 100644 --- a/src/Launcher/Test/CTestTestfileInstall.cmake +++ b/src/Launcher/Test/CTestTestfileInstall.cmake @@ -17,11 +17,6 @@ # 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(COMPONENT_NAME KERNEL) -SET(TIMEOUT 500) - IF(NOT WIN32) ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py) SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}" diff --git a/src/LifeCycleCORBA/Test/CMakeLists.txt b/src/LifeCycleCORBA/Test/CMakeLists.txt index 9402c1b17..9b1aa2c2c 100755 --- a/src/LifeCycleCORBA/Test/CMakeLists.txt +++ b/src/LifeCycleCORBA/Test/CMakeLists.txt @@ -56,17 +56,22 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/LifeCycleCORBA) ADD_LIBRARY(LifeCycleCORBATest LifeCycleCORBATest.cxx) TARGET_LINK_LIBRARIES(LifeCycleCORBATest ${COMMON_LIBS}) -INSTALL(TARGETS LifeCycleCORBATest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS LifeCycleCORBATest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestLifeCycleCORBA TestLifeCycleCORBA.cxx) TARGET_LINK_LIBRARIES(TestLifeCycleCORBA LifeCycleCORBATest NamingServiceTest SalomeLifeCycleCORBA ${COMMON_LIBS}) -INSTALL(TARGETS TestLifeCycleCORBA DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestLifeCycleCORBA DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestLifeCycleCORBA.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestLifeCycleCORBA.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) diff --git a/src/LifeCycleCORBA/Test/CTestTestfileInstall.cmake b/src/LifeCycleCORBA/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..0b92f2387 --- /dev/null +++ b/src/LifeCycleCORBA/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(LifeCycleCORBA python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestLifeCycleCORBA.py) + SET_TESTS_PROPERTIES(LifeCycleCORBA PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py index b4b739810..1d6984f20 100644 --- a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py @@ -72,7 +72,7 @@ clt.waitNS("/SalomeLauncher") # execute Unit Test -command = ['TestLifeCycleCORBA'] +command = ['./TestLifeCycleCORBA'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill containers created by the Container Manager @@ -86,3 +86,4 @@ launcher.Shutdown() addToKillList.killList() TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake b/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..311467a5a --- /dev/null +++ b/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake @@ -0,0 +1,28 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py) + SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}" + # TIMEOUT 500 + ) + # /!\ DO NOT SET TIMEOUT PROPERTY IF USING ${SALOME_TEST_DRIVER} + # BUT PASS TIMEOUT VALUE TO THE DRIVER + +ENDIF() diff --git a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py index 00ba9478c..0e0fc1955 100644 --- a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py +++ b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py @@ -95,3 +95,4 @@ launcher.Shutdown() addToKillList.killList() TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/Logger/Test/TestKiller.py b/src/Logger/Test/TestKiller.py index df88ded00..780fe6e7e 100644 --- a/src/Logger/Test/TestKiller.py +++ b/src/Logger/Test/TestKiller.py @@ -35,9 +35,13 @@ def killNamingService(): line=f.readline() f.close() port=string.split(line,':')[-1][0:4] - command='ps -eo pid,command | grep "omniNames -start '+str(port)+'"' - pid=string.split(commands.getoutput(command))[0] - os.kill(int(pid),signal.SIGKILL) + command='ps -eo pid,command | grep "omniNames -start '+str(port)+'" | grep --invert-match grep' + output_com = commands.getoutput(command) + try: + pid=string.split(output_com)[0] + os.kill(int(pid),signal.SIGKILL) + except: + print "killNamingService failed." def killProcess(process_id): diff --git a/src/NamingService/Test/CMakeLists.txt b/src/NamingService/Test/CMakeLists.txt index d539bedbe..8f134521b 100755 --- a/src/NamingService/Test/CMakeLists.txt +++ b/src/NamingService/Test/CMakeLists.txt @@ -44,10 +44,11 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/NamingService) ADD_LIBRARY(NamingServiceTest NamingServiceTest.cxx) TARGET_LINK_LIBRARIES(NamingServiceTest ${COMMON_LIBS}) -INSTALL(TARGETS NamingServiceTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS NamingServiceTest DESTINATION ${KERNEL_TEST_LIB}) SET(TestNamingService_LIBS NamingServiceTest @@ -64,10 +65,14 @@ SET(TestNamingService_LIBS ADD_EXECUTABLE(TestNamingService TestNamingService.cxx) TARGET_LINK_LIBRARIES(TestNamingService ${TestNamingService_LIBS}) -INSTALL(TARGETS TestNamingService DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestNamingService DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestNamingService.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestNamingService.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) diff --git a/src/NamingService/Test/CTestTestfileInstall.cmake b/src/NamingService/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..c13e7eafb --- /dev/null +++ b/src/NamingService/Test/CTestTestfileInstall.cmake @@ -0,0 +1,27 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(NamingService python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestNamingService.py) + SET_TESTS_PROPERTIES(NamingService PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) + +ENDIF() diff --git a/src/NamingService/Test/TestNamingService.py b/src/NamingService/Test/TestNamingService.py index 44a806750..fdeb07791 100644 --- a/src/NamingService/Test/TestNamingService.py +++ b/src/NamingService/Test/TestNamingService.py @@ -51,7 +51,7 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestNamingService'] +command = ['./TestNamingService'] valgrind = ['valgrind','--leak-check=full'] #command=valgrind+command #to check memory leaks ret = os.spawnvp(os.P_WAIT, command[0], command) @@ -59,3 +59,4 @@ ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/SALOMEDS/Test/CMakeLists.txt b/src/SALOMEDS/Test/CMakeLists.txt index 48d05776e..e9e84cb3a 100755 --- a/src/SALOMEDS/Test/CMakeLists.txt +++ b/src/SALOMEDS/Test/CMakeLists.txt @@ -66,6 +66,7 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/SALOMEDS) IF(WIN32) ADD_DEFINITIONS(-DNOGDI) @@ -73,14 +74,18 @@ ENDIF(WIN32) ADD_LIBRARY(SALOMEDSTest SALOMEDSTest.cxx) TARGET_LINK_LIBRARIES(SALOMEDSTest ${COMMON_LIBS}) -INSTALL(TARGETS SALOMEDSTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS SALOMEDSTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestSALOMEDS TestSALOMEDS.cxx) TARGET_LINK_LIBRARIES(TestSALOMEDS SALOMEDSTest SALOMEBasics ${COMMON_LIBS} ${OMNIORB_LIBRARIES}) -INSTALL(TARGETS TestSALOMEDS DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestSALOMEDS DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestSALOMEDS.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestSALOMEDS.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/SALOMEDS/Test/CTestTestfileInstall.cmake b/src/SALOMEDS/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..19b45454a --- /dev/null +++ b/src/SALOMEDS/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(SALOMEDS python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestSALOMEDS.py) + SET_TESTS_PROPERTIES(SALOMEDS PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/SALOMEDS/Test/TestSALOMEDS.py b/src/SALOMEDS/Test/TestSALOMEDS.py index 68d653c91..90335a706 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.py +++ b/src/SALOMEDS/Test/TestSALOMEDS.py @@ -25,11 +25,12 @@ import sys, os,signal,string,commands import runSalome import orbmodule import TestKiller +import setenv # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server @@ -43,9 +44,10 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestSALOMEDS'] +command = ['./TestSALOMEDS'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/SALOMEDSImpl/Test/CMakeLists.txt b/src/SALOMEDSImpl/Test/CMakeLists.txt index 22eb32d41..e5d83a0b0 100755 --- a/src/SALOMEDSImpl/Test/CMakeLists.txt +++ b/src/SALOMEDSImpl/Test/CMakeLists.txt @@ -60,17 +60,22 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS} ${OMNIORB_DEFINITIONS} ${BOOST_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/SALOMEDSImpl) ADD_LIBRARY(SALOMEDSImplTest SALOMEDSImplTest.cxx) TARGET_LINK_LIBRARIES(SALOMEDSImplTest ${COMMON_LIBS}) -INSTALL(TARGETS SALOMEDSImplTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS SALOMEDSImplTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestSALOMEDSImpl TestSALOMEDSImpl.cxx) TARGET_LINK_LIBRARIES(TestSALOMEDSImpl SALOMEDSImplTest SalomeDSImpl NamingServiceTest ${COMMON_LIBS}) -INSTALL(TARGETS TestSALOMEDSImpl DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestSALOMEDSImpl DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestSALOMEDSImpl.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestSALOMEDSImpl.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/SALOMEDSImpl/Test/CTestTestfileInstall.cmake b/src/SALOMEDSImpl/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..7751fdaab --- /dev/null +++ b/src/SALOMEDSImpl/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(SALOMEDSImpl python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestSALOMEDSImpl.py) + SET_TESTS_PROPERTIES(SALOMEDSImpl PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py index f2a008e01..e1795ba89 100644 --- a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py +++ b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py @@ -25,11 +25,12 @@ import sys, os,signal,string,commands import runSalome import orbmodule import TestKiller +import setenv # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server @@ -43,9 +44,10 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestSALOMEDSImpl'] +command = ['./TestSALOMEDSImpl'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/SALOMELocalTrace/Test/CMakeLists.txt b/src/SALOMELocalTrace/Test/CMakeLists.txt index 3d45463f2..2dd163638 100755 --- a/src/SALOMELocalTrace/Test/CMakeLists.txt +++ b/src/SALOMELocalTrace/Test/CMakeLists.txt @@ -26,17 +26,22 @@ INCLUDE_DIRECTORIES( ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/SALOMELocalTrace) ADD_LIBRARY(SALOMELocalTraceTest SALOMELocalTraceTest.cxx) TARGET_LINK_LIBRARIES(SALOMELocalTraceTest SALOMELocalTrace ${CPPUNIT_LIBRARIES} ${PTHREAD_LIBRARIES} ${PLATFORM_LIBS}) -INSTALL(TARGETS SALOMELocalTraceTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS SALOMELocalTraceTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestSALOMELocalTrace TestSALOMELocalTrace.cxx) TARGET_LINK_LIBRARIES(TestSALOMELocalTrace SALOMELocalTraceTest SALOMELocalTrace SALOMEBasics ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) -INSTALL(TARGETS TestSALOMELocalTrace DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestSALOMELocalTrace DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestSALOMELocalTrace.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestSALOMELocalTrace.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/SALOMELocalTrace/Test/CTestTestfileInstall.cmake b/src/SALOMELocalTrace/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..0fcbfae3d --- /dev/null +++ b/src/SALOMELocalTrace/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(SALOMELocalTrace python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestSALOMELocalTrace.py) + SET_TESTS_PROPERTIES(SALOMELocalTrace PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py index 1e7447baa..4eb8017b4 100644 --- a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py +++ b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py @@ -33,7 +33,8 @@ setenv.set_env(args, modules_list, modules_root_dir) # execute Unit Test -command = ['TestSALOMELocalTrace'] +command = ['./TestSALOMELocalTrace'] ret = os.spawnvp(os.P_WAIT, command[0], command) # no process to kill +exit(ret) \ No newline at end of file diff --git a/src/SALOMETraceCollector/Test/CMakeLists.txt b/src/SALOMETraceCollector/Test/CMakeLists.txt index d0f132338..817231041 100755 --- a/src/SALOMETraceCollector/Test/CMakeLists.txt +++ b/src/SALOMETraceCollector/Test/CMakeLists.txt @@ -37,17 +37,22 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/SALOMETraceCollector) ADD_LIBRARY(SALOMETraceCollectorTest SALOMETraceCollectorTest.cxx) TARGET_LINK_LIBRARIES(SALOMETraceCollectorTest ${COMMON_LIBS}) -INSTALL(TARGETS SALOMETraceCollectorTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS SALOMETraceCollectorTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestSALOMETraceCollector TestSALOMETraceCollector.cxx) TARGET_LINK_LIBRARIES(TestSALOMETraceCollector SALOMETraceCollectorTest ${COMMON_LIBS}) -INSTALL(TARGETS TestSALOMETraceCollector DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestSALOMETraceCollector DESTINATION ${LOCAL_TEST_DIR}) # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(TestSALOMETraceCollector.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestSALOMETraceCollector.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/SALOMETraceCollector/Test/CTestTestfileInstall.cmake b/src/SALOMETraceCollector/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..08c3e29a7 --- /dev/null +++ b/src/SALOMETraceCollector/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(SALOMETraceCollector python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestSALOMETraceCollector.py) + SET_TESTS_PROPERTIES(SALOMETraceCollector PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py b/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py index 66ee7a411..f04cfb6da 100644 --- a/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py +++ b/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py @@ -25,11 +25,12 @@ import sys, os,signal,string,commands import runSalome import orbmodule import TestKiller +import setenv # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server @@ -43,9 +44,10 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestSALOMETraceCollector'] +command = ['./TestSALOMETraceCollector'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/UnitTests/CMakeLists.txt b/src/UnitTests/CMakeLists.txt index 493d03fa7..6254defb4 100755 --- a/src/UnitTests/CMakeLists.txt +++ b/src/UnitTests/CMakeLists.txt @@ -32,7 +32,8 @@ INCLUDE_DIRECTORIES( # =============================================================== # Executable scripts to be installed -SALOME_INSTALL_SCRIPTS(UnitTests.py ${SALOME_INSTALL_SCRIPT_SCRIPTS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/UnitTests) +INSTALL(FILES UnitTests.py DESTINATION ${LOCAL_TEST_DIR}) # =============================================================== # Executables targets @@ -93,4 +94,8 @@ ENDIF() ADD_EXECUTABLE(UnitTests UnitTests.cxx) TARGET_LINK_LIBRARIES(UnitTests ${COMMON_LIBS}) -INSTALL(TARGETS UnitTests DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS UnitTests DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/UnitTests/CTestTestfileInstall.cmake b/src/UnitTests/CTestTestfileInstall.cmake new file mode 100644 index 000000000..4aa37ee19 --- /dev/null +++ b/src/UnitTests/CTestTestfileInstall.cmake @@ -0,0 +1,27 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(UnitTests python ${SALOME_TEST_DRIVER} ${TIMEOUT} UnitTests.py) + SET_TESTS_PROPERTIES(UnitTests PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) + +ENDIF() diff --git a/src/UnitTests/UnitTests.py b/src/UnitTests/UnitTests.py index abc0ceeeb..30bfdfc89 100644 --- a/src/UnitTests/UnitTests.py +++ b/src/UnitTests/UnitTests.py @@ -71,7 +71,7 @@ clt.waitNS("/SalomeLauncher") # execute Unit Test -command = ['UnitTests'] +command = ['./UnitTests'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill containers created by the Container Manager @@ -83,3 +83,4 @@ launcher.Shutdown() # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file diff --git a/src/Utils/Test/CMakeLists.txt b/src/Utils/Test/CMakeLists.txt index 6e1e761fe..df751f478 100755 --- a/src/Utils/Test/CMakeLists.txt +++ b/src/Utils/Test/CMakeLists.txt @@ -41,16 +41,21 @@ SET(COMMON_LIBS ) ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS}) +SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/Utils) ADD_LIBRARY(UtilsTest UtilsTest.cxx) TARGET_LINK_LIBRARIES(UtilsTest ${COMMON_LIBS} ) -INSTALL(TARGETS UtilsTest DESTINATION ${SALOME_INSTALL_LIBS}) +INSTALL(TARGETS UtilsTest DESTINATION ${KERNEL_TEST_LIB}) ADD_EXECUTABLE(TestUtils TestUtils.cxx) TARGET_LINK_LIBRARIES(TestUtils ${COMMON_LIBS} UtilsTest ${OMNIORB_LIBRARIES}) -INSTALL(TARGETS TestUtils DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS TestUtils DESTINATION ${LOCAL_TEST_DIR}) -SALOME_INSTALL_SCRIPTS(TestUtils.py ${SALOME_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES TestUtils.py DESTINATION ${LOCAL_TEST_DIR}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${LOCAL_TEST_DIR}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${LOCAL_TEST_DIR} + RENAME CTestTestfile.cmake) \ No newline at end of file diff --git a/src/Utils/Test/CTestTestfileInstall.cmake b/src/Utils/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..3a06d1f1a --- /dev/null +++ b/src/Utils/Test/CTestTestfileInstall.cmake @@ -0,0 +1,26 @@ +# 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 +# + +IF(NOT WIN32) + ADD_TEST(Utils python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestUtils.py) + SET_TESTS_PROPERTIES(Utils PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "LD_LIBRARY_PATH=${KERNEL_TEST_LIB}:$ENV{LD_LIBRARY_PATH}" + ) +ENDIF() diff --git a/src/Utils/Test/TestUtils.py b/src/Utils/Test/TestUtils.py index 46fe5ca16..3bc8f86c4 100644 --- a/src/Utils/Test/TestUtils.py +++ b/src/Utils/Test/TestUtils.py @@ -25,11 +25,12 @@ import sys, os,signal,string,commands import runSalome import orbmodule import TestKiller +import setenv # get SALOME environment : -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +args, modules_list, modules_root_dir = setenv.get_config() +setenv.set_env(args, modules_list, modules_root_dir) # launch CORBA naming server @@ -43,9 +44,10 @@ clt.waitLogger("Logger") # execute Unit Test -command = ['TestUtils'] +command = ['./TestUtils'] ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) \ No newline at end of file -- 2.39.2