Salome HOME
"salome test" integration.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 24 Jun 2015 08:48:43 +0000 (10:48 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 24 Jun 2015 08:48:43 +0000 (10:48 +0200)
You can run YACS tests with the "salome test" command.
It is still possible to use "make test" in the build directory.

26 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/CTestTestfileInstall.cmake [new file with mode: 0644]
src/bases/Test/CMakeLists.txt
src/bases/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/engine/Test/CMakeLists.txt
src/engine/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/runtime/Test/CMakeLists.txt
src/runtime/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/runtime/Test/runtimeTest.sh
src/yacsloader/Test/CMakeLists.txt
src/yacsloader/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/yacsloader/Test/YacsLoaderInSessionTest.sh.in
src/yacsloader/Test/runYacsLoaderTest.sh [new file with mode: 0644]
src/yacsloader/samples/optimizer1.xml
src/yacsloader/samples/optimizer2.xml
src/yacsloader_swig/Test/CMakeLists.txt
src/yacsloader_swig/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/yacsloader_swig/Test/runUnitTest.sh [new file with mode: 0644]
src/yacsloader_swig/Test/testEdit.py
src/yacsloader_swig/Test/testExec.py
src/yacsloader_swig/Test/testLoader.py
src/yacsloader_swig/Test/testRefcount.py
src/yacsloader_swig/Test/testResume.py
src/yacsloader_swig/Test/testSave.py
src/yacsloader_swig/Test/testSaveLoadRun.py

index fa52f24e51d52e8e613697bfc3ca1311c56c9f29..7f37f1ce781e62f861a7386bd64911d9b5033a87 100644 (file)
@@ -230,12 +230,15 @@ SET(SALOME_YACS_INSTALL_SUPERV_SAMPLES share/salome/yacssupervsamples CACHE PATH
   "Install path: SALOME YACS SUPERV samples")
 SET(SALOME_INSTALL_HXX2SALOME bin/HXX2SALOME_Test CACHE PATH 
   "Install path: SALOME HXX2SALOME Test files")
+SET(SALOME_YACS_INSTALL_TEST ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test CACHE PATH 
+  "Install path: SALOME YACS Test files")
 MARK_AS_ADVANCED(
   SALOME_YACS_INSTALL_RES_DATA
   SALOME_YACS_INSTALL_RES_SCRIPTS
   SALOME_YACS_INSTALL_SAMPLES
   SALOME_YACS_INSTALL_SUPERV_SAMPLES
   SALOME_INSTALL_HXX2SALOME
+  SALOME_YACS_INSTALL_TEST
   )
 
 # Accumulate environment variables for YACS module
index ce9cc73c5912ba19f3f1b2d5e1d7fd608041daf4..9382e5c31764d3147441902f8abf5b6ab8675cb7 100755 (executable)
@@ -52,6 +52,14 @@ IF(SALOME_BUILD_GUI)
   ENDIF()
 ENDIF()
 
+# For salome test
+IF(SALOME_BUILD_TESTS)
+  SET(SALOME_YACS_INSTALL_TEST_LIB ${SALOME_YACS_INSTALL_TEST}/lib)
+  INSTALL(FILES CTestTestfileInstall.cmake
+          DESTINATION ${SALOME_YACS_INSTALL_TEST}
+          RENAME CTestTestfile.cmake)
+ENDIF(SALOME_BUILD_TESTS)
+
 SET(SUBDIRS
   ${SUBDIRS_COMMON}
   ${SUBDIRS_KERNEL}
diff --git a/src/CTestTestfileInstall.cmake b/src/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..87893b4
--- /dev/null
@@ -0,0 +1,35 @@
+# 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 "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME YACS)
+SET(TIMEOUT        500)
+
+SET(YACS_TEST_LIB "../lib")
+
+# Add all test subdirs
+SUBDIRS(
+    bases
+    engine
+    runtime
+    yacsloader
+    yacsloader_swig
+    )
index 26a3ca5d0794400ecd1e7022d97a7c33f8133fa0..45bb235f4af51928b0b485f8734ee0158caccefd 100644 (file)
@@ -43,7 +43,8 @@ SET(TestBases_SOURCES
 # --- rules ---
 
 ADD_LIBRARY(YACSDLTest ${YACSDLTest_SOURCES})
-INSTALL(TARGETS YACSDLTest EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(TARGETS YACSDLTest EXPORT ${PROJECT_NAME}TargetGroup 
+        DESTINATION ${SALOME_YACS_INSTALL_TEST_LIB})
 
 ADD_EXECUTABLE(InitTests ${InitTests_SOURCES})
 ADD_TEST(InitTests InitTests)
@@ -52,4 +53,12 @@ ADD_EXECUTABLE(TestBases ${TestBases_SOURCES})
 TARGET_LINK_LIBRARIES(TestBases YACSBases ${CPPUNIT_LIBRARIES} ${PTHREAD_LIBRARIES})
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 ADD_TEST(TestBases TestBases)
-SET_TESTS_PROPERTIES(TestBases PROPERTIES ENVIRONMENT "${tests_env}")
\ No newline at end of file
+SET_TESTS_PROPERTIES(TestBases PROPERTIES ENVIRONMENT "${tests_env}")
+
+# For salome test
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/bases)
+INSTALL(TARGETS InitTests DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(TARGETS TestBases DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(FILES CTestTestfileInstall.cmake
+        DESTINATION ${LOCAL_TEST_DIR}
+        RENAME CTestTestfile.cmake)
diff --git a/src/bases/Test/CTestTestfileInstall.cmake b/src/bases/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..6ecf633
--- /dev/null
@@ -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(InitTests InitTests)
+  SET_TESTS_PROPERTIES(InitTests PROPERTIES
+                                 LABELS "${COMPONENT_NAME}"
+                      )
+  ADD_TEST(TestBases TestBases)
+  SET_TESTS_PROPERTIES(TestBases PROPERTIES
+                                 LABELS "${COMPONENT_NAME}"
+                                 ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+                      )
+ENDIF()
index 2c5ab118531c9eb90440659d52601eb01fa097c9..5689df553295e91b3107d5366cc76b8dccc4365d 100644 (file)
@@ -65,7 +65,8 @@ SET(IntegrationTestEngine_SOURCES
 
 ADD_LIBRARY(PluginOptEvTest1 ${PluginOptEvTest1_SOURCES})
 TARGET_LINK_LIBRARIES(PluginOptEvTest1 YACSlibEngine)
-INSTALL(TARGETS PluginOptEvTest1 EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(TARGETS PluginOptEvTest1 EXPORT ${PROJECT_NAME}TargetGroup
+        DESTINATION ${SALOME_YACS_INSTALL_TEST_LIB})
 
 ADD_EXECUTABLE(TestEngine ${TestEngine_SOURCES})
 TARGET_LINK_LIBRARIES(TestEngine ${_link_LIBRARIES})
@@ -75,4 +76,12 @@ ADD_EXECUTABLE(IntegrationTestEngine ${IntegrationTestEngine_SOURCES})
 TARGET_LINK_LIBRARIES(IntegrationTestEngine ${_link_LIBRARIES})
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 ADD_TEST(IntegrationTestEngine IntegrationTestEngine)
-SET_TESTS_PROPERTIES(IntegrationTestEngine PROPERTIES ENVIRONMENT "${tests_env}")
\ No newline at end of file
+SET_TESTS_PROPERTIES(IntegrationTestEngine PROPERTIES ENVIRONMENT "${tests_env}")
+
+# For salome test
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/engine)
+INSTALL(TARGETS TestEngine DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(TARGETS IntegrationTestEngine 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/engine/Test/CTestTestfileInstall.cmake b/src/engine/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..97e5c17
--- /dev/null
@@ -0,0 +1,31 @@
+# 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(TestEngine TestEngine)
+  SET_TESTS_PROPERTIES(TestEngine PROPERTIES
+                                  LABELS "${COMPONENT_NAME}"
+                      )
+
+  ADD_TEST(IntegrationTestEngine IntegrationTestEngine)
+  SET_TESTS_PROPERTIES(IntegrationTestEngine PROPERTIES
+                                     LABELS "${COMPONENT_NAME}"
+                                     ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+                      )
+ENDIF()
index b3fc8a90d5776605271fd31e07800ea95eff48bf..3589502f83d137e9bb38fbe5bc1d74c1e3169d63 100644 (file)
@@ -104,7 +104,11 @@ TARGET_LINK_LIBRARIES(echo_clt runtime_echo ${OMNIORB_LIBRARIES})
 
 ADD_LIBRARY(TestComponentLocal ${TestComponentLocal_SOURCES})
 TARGET_LINK_LIBRARIES(TestComponentLocal YACSlibEngine)
-INSTALL(TARGETS TestComponentLocal EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
+# For salome test
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/runtime)
+INSTALL(TARGETS TestComponentLocal EXPORT ${PROJECT_NAME}TargetGroup
+        DESTINATION ${LOCAL_TEST_DIR}/lib/salome)
 
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 
@@ -112,5 +116,15 @@ IF(NOT WIN32)
   SET(SHELL /bin/sh)
   SALOME_CONFIGURE_FILE(xmlrun_orig.sh xmlrun.sh)
   ADD_TEST(NAME runtimeTest COMMAND ${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/runtimeTest.sh)
-  SET_TESTS_PROPERTIES(runtimeTest PROPERTIES ENVIRONMENT "${tests_env}") 
+  SET_TESTS_PROPERTIES(runtimeTest PROPERTIES ENVIRONMENT "${tests_env}")
 ENDIF() 
+
+INSTALL(PROGRAMS runtimeTest.sh DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/xmlrun.sh DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(TARGETS runtime_echo DESTINATION ${SALOME_YACS_INSTALL_TEST_LIB})
+INSTALL(TARGETS TestRuntime DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(TARGETS runtimeTestEchoSrv DESTINATION ${LOCAL_TEST_DIR})
+INSTALL(TARGETS echo_clt 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/runtime/Test/CTestTestfileInstall.cmake b/src/runtime/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..bf7127f
--- /dev/null
@@ -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)
+  SET(SHELL /bin/sh)
+  ADD_TEST(YacsRuntimeTest ${SHELL} ./runtimeTest.sh)
+  SET_TESTS_PROPERTIES(YacsRuntimeTest PROPERTIES
+                                     LABELS "${COMPONENT_NAME}"
+                                     ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+                      )
+ENDIF()
index 8651363f099969dadd1b4a9acebf3c3eb9272b19..7923a79e48b3c18a0f60c2b012a1b99f9f548ef6 100644 (file)
@@ -48,8 +48,11 @@ sleep 2
 pidecho=$!
 echo $pidecho
 
-mkdir -p lib/salome
-cp libTestComponentLocal.so lib/salome
+if ! [ -f lib/salome/libTestComponentLocal.so ]
+then
+  mkdir -p lib/salome
+  cp libTestComponentLocal.so lib/salome
+fi
 export TESTCOMPONENT_ROOT_DIR=`pwd`
 
 #wait enough time to let runtimeTestEchoSrv start and register
index dbecc34415bffee3249a70d0f1d6fa7609d1f7c8..21dbcdb234c50e64663eebf3a5cdabbfb2ada515 100644 (file)
@@ -89,6 +89,7 @@ SET(TestOptLoop_SOURCES
 )
 
 # --- rules ---
+SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/yacsloader)
 
 OMNIORB_ADD_MODULE(yacsloader_echo "${echo_IDL_FILES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_FLAGS}")
 INSTALL(TARGETS yacsloader_echo DESTINATION ${SALOME_INSTALL_LIBS})
@@ -98,7 +99,6 @@ TARGET_LINK_LIBRARIES(TestYacsLoader yacsloader_echo ${TestYacsLoader_LIBRARIES}
 
 ADD_EXECUTABLE(echoSrv ${echoSrv_SOURCES})
 TARGET_LINK_LIBRARIES(echoSrv yacsloader_echo ${echoSrv_LIBRARIES})
-INSTALL(TARGETS echoSrv DESTINATION ${SALOME_INSTALL_BINS})
 
 ADD_LIBRARY(TestOptLoop ${TestOptLoop_SOURCES})
 TARGET_LINK_LIBRARIES(TestOptLoop yacsloader_echo YACSlibEngine)
@@ -114,3 +114,26 @@ IF(NOT WIN32)
   ADD_TEST(NAME YacsLoaderTest COMMAND ${SHELL} YacsLoaderTest.sh)
 ENDIF()
 
+# For salome test
+IF(NOT WIN32)
+  SET(LOCAL_TEST_FILES
+    algoasyncexample.py
+    algosyncexample.py
+    genPascal.py
+    genTriangle.py
+    echoclt.py)
+  INSTALL(FILES ${LOCAL_TEST_FILES}
+          DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(TARGETS echoSrv TestYacsLoader
+          DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(TARGETS yacsloader_echo TestOptLoop
+          DESTINATION ${SALOME_YACS_INSTALL_TEST_LIB})
+  INSTALL(FILES CTestTestfileInstall.cmake
+          DESTINATION ${LOCAL_TEST_DIR}
+          RENAME CTestTestfile.cmake)
+  INSTALL(PROGRAMS runYacsLoaderTest.sh ${CMAKE_CURRENT_BINARY_DIR}/xmlrun.sh
+          DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
+                ${CMAKE_INSTALL_PREFIX}/${SALOME_YACS_INSTALL_SAMPLES}
+                ${CMAKE_INSTALL_PREFIX}/${LOCAL_TEST_DIR}/samples )" )
+ENDIF()
diff --git a/src/yacsloader/Test/CTestTestfileInstall.cmake b/src/yacsloader/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..d03fc76
--- /dev/null
@@ -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(YacsLoaderTest python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./runYacsLoaderTest.sh)
+  SET_TESTS_PROPERTIES(YacsLoaderTest PROPERTIES
+                                     LABELS "${COMPONENT_NAME}"
+                                     ENVIRONMENT "LD_LIBRARY_PATH=${YACS_TEST_LIB}:$ENV{LD_LIBRARY_PATH}"
+                      )
+ENDIF()
index 40b0dfe86fd1012d4fa36bdc79b45b518cf8d1af..8db7336941e83735af9d69bc118775823bf161c2 100755 (executable)
@@ -32,6 +32,7 @@ echo $pidecho > "/tmp/YACSTEST_PidEcho"
 
 # Environment variables needed for the optimizer loop tests
 export LD_LIBRARY_PATH=@CMAKE_CURRENT_BINARY_DIR@:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=../../engine/Test:$LD_LIBRARY_PATH
 export PYTHONPATH=@CMAKE_BINARY_DIR@/src/engine_swig:$PYTHONPATH
 export PYTHONPATH=@CMAKE_BINARY_DIR@/src/runtime_swig:$PYTHONPATH
 export PYTHONPATH=@CMAKE_CURRENT_SOURCE_DIR@:$PYTHONPATH
diff --git a/src/yacsloader/Test/runYacsLoaderTest.sh b/src/yacsloader/Test/runYacsLoaderTest.sh
new file mode 100644 (file)
index 0000000..4b53bbf
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Copyright (C) 2006-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
+#
+
+# script used by "salome test" command
+./echoSrv &
+pidecho=$!
+echo $pidecho > "/tmp/YACSTEST_PidEcho"
+
+export TESTCOMPONENT_ROOT_DIR=`pwd`/../runtime
+
+./TestYacsLoader
+ret=$?
+echo "exec status TestYacsLoader " $ret
+
+kill -9 `cat "/tmp/YACSTEST_PidEcho"`
+
+exit $ret
\ No newline at end of file
index e989d091d9eac56ab382c7080fffff46ed89de3f..1467cca78bfa79ecd7d7a04151ce84e7216c7c37 100644 (file)
@@ -23,7 +23,7 @@
     <!--types -->
 
     <!--nodes -->
-    <optimizer name="b1" nbranch="4" lib="../../engine/Test/libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
+    <optimizer name="b1" nbranch="4" lib="libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
       <inline name="node2" >
         <script >
             <code>p1= p1+10.</code>
index 0729ea9e1591fe7bbefb1e6e1627826775f9b27b..6df8b206a8504f3e6bed0040bcc90fb3eb420ad6 100644 (file)
@@ -23,7 +23,7 @@
     <!--types -->
 
     <!--nodes -->
-    <optimizer name="b1" nbranch="4" lib="../../engine/Test/libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
+    <optimizer name="b1" nbranch="4" lib="libPluginOptEvTest1" entry="PluginOptEvTest1Factory" >
       <bloc name="b" >
       <inline name="node2" >
         <script >
index 0392733c75eeda8719b8dd71de2b9cc8d5e8742d..6ac0e5552a139e420134a99067a73d925d7562a0 100644 (file)
@@ -29,4 +29,27 @@ IF(NOT WIN32)
   SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
   ADD_TEST(NAME StdAloneYacsLoaderTest1 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/StdAloneYacsLoaderTest1.py)
   SET_TESTS_PROPERTIES(StdAloneYacsLoaderTest1 PROPERTIES ENVIRONMENT "${tests_env}")
-ENDIF() 
+
+  # For salome test
+  SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/yacsloader_swig)
+  SET(LOCAL_TEST_FILES
+    StdAloneYacsLoaderTest1.py
+    testEdit.py
+    testExec.py
+    testLoader.py
+    testRefcount.py
+    testResume.py
+    testSave.py
+    testSaveLoadRun.py
+   )
+  INSTALL(FILES ${LOCAL_TEST_FILES}
+        DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(PROGRAMS runUnitTest.sh
+        DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(FILES CTestTestfileInstall.cmake
+        DESTINATION ${LOCAL_TEST_DIR}
+        RENAME CTestTestfile.cmake)
+  INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
+                ${CMAKE_INSTALL_PREFIX}/${SALOME_YACS_INSTALL_SAMPLES}
+                ${CMAKE_INSTALL_PREFIX}/${LOCAL_TEST_DIR}/samples )" )
+ENDIF()
diff --git a/src/yacsloader_swig/Test/CTestTestfileInstall.cmake b/src/yacsloader_swig/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..3ec46fb
--- /dev/null
@@ -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(YacsLoaderTest_swig python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./runUnitTest.sh)
+  SET_TESTS_PROPERTIES(YacsLoaderTest_swig PROPERTIES
+                                     LABELS "${COMPONENT_NAME}"
+                      )
+
+  ADD_TEST(StdAloneYacsLoaderTest1 python ${SALOME_TEST_DRIVER} ${TIMEOUT} python StdAloneYacsLoaderTest1.py)
+  SET_TESTS_PROPERTIES(StdAloneYacsLoaderTest1 PROPERTIES
+                                     LABELS "${COMPONENT_NAME}"
+                      )
+ENDIF()
diff --git a/src/yacsloader_swig/Test/runUnitTest.sh b/src/yacsloader_swig/Test/runUnitTest.sh
new file mode 100644 (file)
index 0000000..49926df
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Copyright (C) 2006-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
+#
+
+# script used by "salome test" command
+../yacsloader/echoSrv &
+pidecho=$!
+echo $pidecho > "/tmp/YACSTEST_PidEcho"
+
+export TESTCOMPONENT_ROOT_DIR=`pwd`/../runtime
+
+python -m unittest discover
+ret=$?
+echo "exec status salome_test_driver " $ret
+
+kill -9 `cat "/tmp/YACSTEST_PidEcho"`
+
+exit $ret
\ No newline at end of file
index 29afb59b4f1044480aee59a38fe239f25edd2a54..e10d35b6a952edec5a69384137afc705eebc59e3 100755 (executable)
@@ -195,11 +195,12 @@ def f():
         #self.e.displayDot(p)
 
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testEdit.py\n")
-suite = unittest.makeSuite(TestEdit)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testEdit.py\n")
+  suite = unittest.makeSuite(TestEdit)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
index dba27ca94d6a03277fdf7b871eab850021d09873..7adeac947008846c1f27c7a0f2f4a33ed148f61a 100755 (executable)
@@ -178,11 +178,12 @@ class TestExec(unittest.TestCase):
                           
     pass
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testExec.py\n")
-suite = unittest.makeSuite(TestExec)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testExec.py\n")
+  suite = unittest.makeSuite(TestExec)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
\ No newline at end of file
index 686ee13b06c7f7d53624cb657b232903aa3963e2..0db41e151b2de17922570cb43ca30fbc3781b705 100755 (executable)
@@ -82,11 +82,12 @@ class TestLoader(unittest.TestCase):
       pass
     pass
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testLoader.py\n")
-suite = unittest.makeSuite(TestLoader)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testLoader.py\n")
+  suite = unittest.makeSuite(TestLoader)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
\ No newline at end of file
index 99e32323dcf1efb5a43174697f11393b392635a1..13d4efbcffc9cdea4581bdf8794075c3ce94fe40 100755 (executable)
@@ -265,13 +265,14 @@ class TestTypeCodeRef(unittest.TestCase):
     self.assert_(tc.thisown)
     self.assertEqual(tc.getRefCnt(), 3)
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testRefcount.py\n")
-suite1 = unittest.makeSuite(TestContainerRef)
-suite2 = unittest.makeSuite(TestTypeCodeRef)
-suite = unittest.TestSuite((suite1, suite2))
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testRefcount.py\n")
+  suite1 = unittest.makeSuite(TestContainerRef)
+  suite2 = unittest.makeSuite(TestTypeCodeRef)
+  suite = unittest.TestSuite((suite1, suite2))
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
\ No newline at end of file
index 26dc10bbd31c7c8de275392005861708b11d4b98..6b8cb127e07da9d78f6e86c6b3b23cc411bd7941 100755 (executable)
@@ -85,11 +85,12 @@ class TestResume(unittest.TestCase):
                           
     pass
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testResume.py\n")
-suite = unittest.makeSuite(TestResume)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testResume.py\n")
+  suite = unittest.makeSuite(TestResume)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
\ No newline at end of file
index bd39afb2e764b2960dd19f0e2cd0c8d30b584b09..9923a73b4e3aa59b1543e58d9f7d659bc666248a 100755 (executable)
@@ -93,13 +93,13 @@ class TestSave(unittest.TestCase):
             self.assertEqual(ls1,ls2,pb1)
             self.assertEqual(ld1,ld2,pb2)            
             pass
-        
 
-import os
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testSave.py\n")
-suite = unittest.makeSuite(TestSave)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testSave.py\n")
+  suite = unittest.makeSuite(TestSave)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())
\ No newline at end of file
index 5c1c5d0aceace338080605d759cd41a25226a184..28566ac3ee6609b95ac38401c247a94008eebaa5 100755 (executable)
@@ -942,11 +942,12 @@ else:
 
   pass
 
-import os,sys
-U = os.getenv('USER')
-f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-f.write("  --- TEST src/yacsloader: testSaveLoadRun.py\n")
-suite = unittest.makeSuite(TestSaveLoadRun)
-result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-f.close()
-sys.exit(not result.wasSuccessful())
+if __name__ == '__main__':
+  import os,sys
+  U = os.getenv('USER')
+  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
+  f.write("  --- TEST src/yacsloader: testSaveLoadRun.py\n")
+  suite = unittest.makeSuite(TestSaveLoadRun)
+  result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  f.close()
+  sys.exit(not result.wasSuccessful())