From 5afb215e8cb2d83858c2bd711e34795886dc80c7 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 29 Dec 2014 16:49:02 +0100 Subject: [PATCH] All tests in src directory use "make test". Some tests fail at this point: LifeCycleCORBA SALOMEDS They need further work in order to be fixed. --- src/Basics/Test/CMakeLists.txt | 1 + .../Test}/prepare_test.py | 36 ++++++++++++------- src/KernelHelpers/Test/CMakeLists.txt | 6 ++++ src/KernelHelpers/Test/TestKernelHelpers.py | 6 ++-- src/LifeCycleCORBA/Test/CMakeLists.txt | 5 +++ .../Test/LifeCycleCORBATest.cxx | 4 +-- src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py | 1 + src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt | 12 +++++++ .../Test/TestLifeCycleCORBA_SWIG.py | 1 + src/Logger/Test/TestKiller.py | 10 ++++-- src/NamingService/Test/CMakeLists.txt | 12 +++---- src/SALOMEDS/Test/CMakeLists.txt | 6 ++++ src/SALOMEDS/Test/TestSALOMEDS.cxx | 8 ++++- src/SALOMEDS/Test/TestSALOMEDS.py | 6 ++-- src/SALOMEDSImpl/Test/CMakeLists.txt | 6 ++++ src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py | 6 ++-- src/SALOMELocalTrace/Test/CMakeLists.txt | 5 +++ .../Test/TestSALOMELocalTrace.py | 1 + src/SALOMETraceCollector/Test/CMakeLists.txt | 12 +++---- .../Test/TestSALOMETraceCollector.py | 5 +-- src/UnitTests/CMakeLists.txt | 13 +++---- src/UnitTests/UnitTests.py | 1 + src/Utils/Test/CMakeLists.txt | 6 ++++ src/Utils/Test/TestUtils.py | 6 ++-- 24 files changed, 126 insertions(+), 49 deletions(-) rename src/{UnitTests => Basics/Test}/prepare_test.py (72%) diff --git a/src/Basics/Test/CMakeLists.txt b/src/Basics/Test/CMakeLists.txt index e512edf5c..23f2808cc 100755 --- a/src/Basics/Test/CMakeLists.txt +++ b/src/Basics/Test/CMakeLists.txt @@ -19,3 +19,4 @@ FILE(GLOB SALOMEBasics_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${SALOMEBasics_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +SALOME_INSTALL_SCRIPTS(prepare_test.py ${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests) diff --git a/src/UnitTests/prepare_test.py b/src/Basics/Test/prepare_test.py similarity index 72% rename from src/UnitTests/prepare_test.py rename to src/Basics/Test/prepare_test.py index 71a296af1..d0a381fed 100755 --- a/src/UnitTests/prepare_test.py +++ b/src/Basics/Test/prepare_test.py @@ -3,14 +3,16 @@ usage=""" This script prepares the test environment and runs a test script: - - clean and create test directory - - create a SALOME application + - if SALOME_APPLI_PATH is not defined, create a new SALOME application - launch salome - launch the test script within SALOME environment - kill salome This script uses the following environment variables: - - ROOT_SALOME : directory which contains salome_context.cfg. + - SALOME_APPLI_PATH : directory of a SALOME application, target of the test + - ROOT_SALOME : if SALOME_APPLI_PATH is not defined, use ROOT_SALOME in + order to provide a directory which contains the file + salome_context.cfg and build a new application based on it. This variable is usually defined in salome_prerequisites.sh - KERNEL_ROOT_DIR and YACS_ROOT_DIR : directories of modules installation Those variables are usually defined in salome_modules.sh @@ -19,11 +21,17 @@ This script prepares the test environment and runs a test script: import os import sys +import shutil class TestEnvironment: - def setUp(self): - import shutil - shutil.rmtree("appli", ignore_errors=True) + def findSalomeAppli(self): + self.appli_dir = os.getenv("SALOME_APPLI_PATH") + if os.path.isdir(self.appli_dir): + return + else: + print "Invalid SALOME_APPLI_PATH. Trying to build a customised Salome application." + self.appli_dir = "appli" + shutil.rmtree(self.appli_dir, ignore_errors=True) # create config_appli.xml in current directory salome_path = os.getenv("ROOT_SALOME", "") @@ -64,21 +72,22 @@ class TestEnvironment: # create a SALOME application appli_gen_file = os.path.join(kernel_path, "bin","salome","appli_gen.py") - appli_dir = "appli" - os.system(appli_gen_file + " --prefix="+appli_dir+ + os.system(appli_gen_file + " --prefix="+self.appli_dir+ " --config=config_appli.xml") + def startSalome(self): # start salome import imp - sys.path[:0] = [os.path.join(appli_dir, "bin", "salome", "appliskel")] - self.salome_module = imp.load_source("SALOME", os.path.join(appli_dir, "salome")) + sys.path[:0] = [os.path.join(self.appli_dir, "bin", "salome", "appliskel")] + self.salome_module = imp.load_source("SALOME", + os.path.join(self.appli_dir, "salome")) try: self.salome_module.main(["start", "-t"]) except SystemExit, e: # There is an exit() call in salome.main. Just ignore it. pass - def run(self, script): + def runTest(self, script): ret = 0 try: ret = self.salome_module.main(["shell", script]) @@ -108,8 +117,9 @@ if __name__ == '__main__': os.environ[opts[0]] = opts[1] envTest = TestEnvironment() - envTest.setUp() - ret = envTest.run(args.command) + envTest.findSalomeAppli() + envTest.startSalome() + ret = envTest.runTest(args.command) envTest.tearDown() exit(ret) pass diff --git a/src/KernelHelpers/Test/CMakeLists.txt b/src/KernelHelpers/Test/CMakeLists.txt index 41313f939..ff1cfaf79 100755 --- a/src/KernelHelpers/Test/CMakeLists.txt +++ b/src/KernelHelpers/Test/CMakeLists.txt @@ -66,3 +66,9 @@ SALOME_INSTALL_SCRIPTS(TestKernelHelpers.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) + +ADD_TEST(NAME KernelHelpers + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestKernelHelpers.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/KernelHelpers/Test/TestKernelHelpers.py b/src/KernelHelpers/Test/TestKernelHelpers.py index ba69f9baa..c36b58a01 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 @@ -49,3 +50,4 @@ ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process TestKiller.killProcess(runSalome.process_id) +exit(ret) diff --git a/src/LifeCycleCORBA/Test/CMakeLists.txt b/src/LifeCycleCORBA/Test/CMakeLists.txt index 8d31c9383..df0424fc0 100755 --- a/src/LifeCycleCORBA/Test/CMakeLists.txt +++ b/src/LifeCycleCORBA/Test/CMakeLists.txt @@ -70,3 +70,8 @@ SALOME_INSTALL_SCRIPTS(TestLifeCycleCORBA.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +ADD_TEST(NAME LifeCycleCORBA + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestLifeCycleCORBA.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx index f95cccdb9..7ef456480 100644 --- a/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx +++ b/src/LifeCycleCORBA/Test/LifeCycleCORBATest.cxx @@ -624,7 +624,7 @@ void LifeCycleCORBATest::testgetLocalFile_localComputer() { SALOME_LifeCycleCORBA _LCC(&_NS); std::string origFileName = getenv("KERNEL_ROOT_DIR"); - origFileName += "/lib/salome/libSalomeLifeCycleCORBA.so.0.0.0"; + origFileName += "/idl/salome/SALOME_Types.idl"; SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(), origFileName); std::string local = transfer.getLocalFile(); @@ -642,7 +642,7 @@ void LifeCycleCORBATest::testgetLocalFile_remoteComputer() { SALOME_LifeCycleCORBA _LCC(&_NS); std::string origFileName = getenv("KERNEL_ROOT_DIR"); - origFileName += "/lib/salome/libSalomeContainer.so.0.0.0"; + origFileName += "/idl/salome/SALOME_Types.idl"; SALOME_FileTransferCORBA transfer( GetRemoteHost(), origFileName); std::string local = transfer.getLocalFile(); diff --git a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py index 0dbc8625f..866d4d6e8 100644 --- a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py @@ -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/CMakeLists.txt b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt index a6831e7ab..27b79b8c4 100755 --- a/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt +++ b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt @@ -26,3 +26,15 @@ SET(SCRIPTS ) SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) + +ADD_TEST(NAME LifeCycleCORBA_SWIGTest + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/LifeCycleCORBA_SWIGTest.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) + +#ADD_TEST(NAME TestLifeCycleCORBA_SWIG +# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py +# ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestLifeCycleCORBA_SWIG.py +# -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} +# ) diff --git a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py index 089cfeae5..0e46b7f62 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 a9512da1b..d878b10c4 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 4a61d5160..758ef0947 100755 --- a/src/NamingService/Test/CMakeLists.txt +++ b/src/NamingService/Test/CMakeLists.txt @@ -72,10 +72,8 @@ SALOME_INSTALL_SCRIPTS(TestNamingService.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) -IF(NOT WIN32) - ADD_TEST(NAME NamingService - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py - ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestNamingService.py - -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} - ) -ENDIF() +ADD_TEST(NAME NamingService + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestNamingService.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/SALOMEDS/Test/CMakeLists.txt b/src/SALOMEDS/Test/CMakeLists.txt index babc8e91f..69a3830b5 100755 --- a/src/SALOMEDS/Test/CMakeLists.txt +++ b/src/SALOMEDS/Test/CMakeLists.txt @@ -84,3 +84,9 @@ SALOME_INSTALL_SCRIPTS(TestSALOMEDS.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) + +ADD_TEST(NAME SALOMEDS + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestSALOMEDS.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 3b4601d41..e560ab412 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -31,6 +31,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest ); CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); +// --- generic Main program from Basic/Test + +#include "BasicMainTest.hxx" + +/* #include #include #include @@ -61,7 +66,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); /*! * Main program source for Unit Tests with cppunit package does not depend * on actual tests, so we use the same for all partial unit tests. - */ + * / // ============================================================================ int main(int argc, char* argv[]) @@ -181,3 +186,4 @@ int main(int argc, char* argv[]) return wasSucessful ? 0 : 1; } +*/ \ No newline at end of file diff --git a/src/SALOMEDS/Test/TestSALOMEDS.py b/src/SALOMEDS/Test/TestSALOMEDS.py index fbb61ef23..68c63fdd7 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 @@ -49,3 +50,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/SALOMEDSImpl/Test/CMakeLists.txt b/src/SALOMEDSImpl/Test/CMakeLists.txt index 58569be97..74b60c1e7 100755 --- a/src/SALOMEDSImpl/Test/CMakeLists.txt +++ b/src/SALOMEDSImpl/Test/CMakeLists.txt @@ -74,3 +74,9 @@ SALOME_INSTALL_SCRIPTS(TestSALOMEDSImpl.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) + +ADD_TEST(NAME SALOMEDSImpl + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestSALOMEDSImpl.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py index c94e7e0ac..bbf3d7f36 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 @@ -49,3 +50,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/SALOMELocalTrace/Test/CMakeLists.txt b/src/SALOMELocalTrace/Test/CMakeLists.txt index 1507ee24a..d9fd59844 100755 --- a/src/SALOMELocalTrace/Test/CMakeLists.txt +++ b/src/SALOMELocalTrace/Test/CMakeLists.txt @@ -40,3 +40,8 @@ SALOME_INSTALL_SCRIPTS(TestSALOMELocalTrace.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) +ADD_TEST(NAME SALOMELocalTrace + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestSALOMELocalTrace.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py index c83ee7b70..6211cc0d9 100644 --- a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py +++ b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py @@ -37,3 +37,4 @@ 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 ae530f1d7..d46255806 100755 --- a/src/SALOMETraceCollector/Test/CMakeLists.txt +++ b/src/SALOMETraceCollector/Test/CMakeLists.txt @@ -52,10 +52,8 @@ SALOME_INSTALL_SCRIPTS(TestSALOMETraceCollector.py ${SALOME_INSTALL_SCRIPT_PYTHO FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) -IF(NOT WIN32) - ADD_TEST(NAME TraceCollector - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py - ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestSALOMETraceCollector.py - -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} - ) -ENDIF() +ADD_TEST(NAME TraceCollector + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestSALOMETraceCollector.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py b/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py index 04800de65..faa66cddd 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 diff --git a/src/UnitTests/CMakeLists.txt b/src/UnitTests/CMakeLists.txt index 158be534d..e7065e34f 100755 --- a/src/UnitTests/CMakeLists.txt +++ b/src/UnitTests/CMakeLists.txt @@ -32,13 +32,7 @@ INCLUDE_DIRECTORIES( # =============================================================== # Executable scripts to be installed -SET(py_SCRIPTS - UnitTests.py - prepare_test.py -) - SALOME_INSTALL_SCRIPTS(UnitTests.py ${SALOME_INSTALL_SCRIPT_SCRIPTS}) -SALOME_INSTALL_SCRIPTS(prepare_test.py ${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests) # =============================================================== # Executables targets @@ -100,3 +94,10 @@ ENDIF() ADD_EXECUTABLE(UnitTests UnitTests.cxx) TARGET_LINK_LIBRARIES(UnitTests ${COMMON_LIBS}) INSTALL(TARGETS UnitTests DESTINATION ${SALOME_INSTALL_BINS}) +IF(NOT WIN32) + ADD_TEST(NAME UnitTests + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/UnitTests.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) +ENDIF() diff --git a/src/UnitTests/UnitTests.py b/src/UnitTests/UnitTests.py index fa6f91e2a..32b6efceb 100644 --- a/src/UnitTests/UnitTests.py +++ b/src/UnitTests/UnitTests.py @@ -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 8f49727ff..8fc7bbe58 100755 --- a/src/Utils/Test/CMakeLists.txt +++ b/src/Utils/Test/CMakeLists.txt @@ -54,3 +54,9 @@ SALOME_INSTALL_SCRIPTS(TestUtils.py ${SALOME_INSTALL_SCRIPT_PYTHON}) FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) + +ADD_TEST(NAME Utils + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_SCRIPTS}/Tests/prepare_test.py + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_SCRIPT_PYTHON}/TestUtils.py + -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX} + ) diff --git a/src/Utils/Test/TestUtils.py b/src/Utils/Test/TestUtils.py index b61203b53..a8485f795 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 @@ -49,3 +50,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 -- 2.39.2