]> SALOME platform Git repositories - tools/ydefx.git/commitdiff
Salome HOME
Salome test and some fixes.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 8 Mar 2019 15:47:14 +0000 (16:47 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 8 Mar 2019 15:47:14 +0000 (16:47 +0100)
CMakeLists.txt
src/CMakeLists.txt
src/CTestTestfileInstall.cmake [new file with mode: 0644]
src/cpp/SamplePyConversions.hxx
src/cpp/Test/CMakeLists.txt
src/cpp/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/pydefx/pystudy.py
src/pydefx/samplecsviterator.py

index eed83b139f566f2a0c3dc7bdb12b4886dfdc4607..d9ae075ecf4e5f31d7e646e342730f1154ad8808 100644 (file)
@@ -33,6 +33,10 @@ FIND_PACKAGE(SalomeKERNEL NO_MODULE)
 
 IF(NOT SalomeKERNEL_FOUND)
   MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used")
+ELSE()
+  SET(SALOME_BUILD_TESTS ON)
+  SET(SALOME_YDEFX_INSTALL_TEST ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test CACHE PATH
+      "Install path: SALOME Test files")
 ENDIF()
 
 IF(NOT DEFINED SALOME_INSTALL_PYTHON)
index 5da96bc50a21a72b78cfe94f2bf2a0eb07588fda..767b2b54222e3f509982eadcda5bbcaad12f9690 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
+# For salome test
+IF(SALOME_BUILD_TESTS)
+  INSTALL(FILES CTestTestfileInstall.cmake
+          DESTINATION ${SALOME_YDEFX_INSTALL_TEST}
+          RENAME CTestTestfile.cmake)
+ENDIF(SALOME_BUILD_TESTS)
+
 ADD_SUBDIRECTORY(cpp)
 ADD_SUBDIRECTORY(pydefx)
 IF(YDEFX_BUILD_GUI)
diff --git a/src/CTestTestfileInstall.cmake b/src/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..4809113
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) 2019  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{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME YDEFX)
+SET(TIMEOUT        500)
+
+SUBDIRS(
+    cpp
+    )
index a3de77bd9b077fb880d38328f318ed47ef76bb12..19db48f4d318a0c0edbdeaa4843973dec4540519 100644 (file)
@@ -346,7 +346,7 @@ py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample)
       if(Py_None != pyValue)
         check.addError(py2cpp::fromPy(pyValue, cppValue));
       if(check)
-        sample.errors().push_back(cppValue);
+        sample.errors()[i] = cppValue;
     }
   }
   else
index b91193d9fa1d241bfd4cc81bcef9c53e52c497ac..0e98033aa172ed6d17cd0a653083085f90c379e8 100644 (file)
@@ -52,3 +52,13 @@ TARGET_LINK_LIBRARIES(StudyRestartTest ${_link_LIBRARIES})
 ADD_TEST(YdefxStudyRestartTest StudyRestartTest)
 SET_TESTS_PROPERTIES(YdefxStudyRestartTest PROPERTIES ENVIRONMENT
                     "PYTHONPATH=${CMAKE_SOURCE_DIR}/src:$ENV{PYTHONPATH}")
+IF(SALOME_BUILD_TESTS)
+  # For salome test
+  SET(LOCAL_TEST_DIR ${SALOME_YDEFX_INSTALL_TEST}/cpp)
+  INSTALL(TARGETS SampleTest DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(TARGETS StudyGeneralTest DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(TARGETS StudyRestartTest DESTINATION ${LOCAL_TEST_DIR})
+  INSTALL(FILES CTestTestfileInstall.cmake
+          DESTINATION ${LOCAL_TEST_DIR}
+          RENAME CTestTestfile.cmake)
+ENDIF()
diff --git a/src/cpp/Test/CTestTestfileInstall.cmake b/src/cpp/Test/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..c28a019
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright (C) 2019  EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(TEST_NAME ${COMPONENT_NAME}_SampleTest)
+ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./SampleTest)
+SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
+                                  LABELS "${COMPONENT_NAME}"
+                    )
+
+SET(TEST_NAME ${COMPONENT_NAME}_StudyGeneralTest)
+ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./StudyGeneralTest)
+SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
+                                  LABELS "${COMPONENT_NAME}"
+                    )
+
+SET(TEST_NAME ${COMPONENT_NAME}_StudyRestartTest)
+ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ./StudyRestartTest)
+SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
+                                  LABELS "${COMPONENT_NAME}"
+                    )
+                    
index deb9a0df0270a0989fc3021293781e9a2f65bb71..48d272cee1178004e2f52e0baeb0e3181fb60dca 100644 (file)
@@ -43,6 +43,8 @@ def prepareDirectoryForLaunch(sample, result_directory, nb_branches, script,
   """
   if sampleManager is None:
     sampleManager = defaultSampleManager()
+  if not os.path.exists(result_directory):
+    os.makedirs(result_directory)
   # export sample to result_directory
   inputFiles = sampleManager.prepareRun(script, sample, result_directory)
 
index df8359d948b66c334ac2ec2abe0f3677300480bd..8e79dc02203d9d992cd0e2dbaceab1b2acfeb8b8 100644 (file)
@@ -52,7 +52,7 @@ class SampleIterator:
       datapath = SampleIterator.DATAFILE
       outputnamespath = SampleIterator.OUTPUTNAMESFILE
       resultpath = SampleIterator.RESULTFILE
-      
+
     self.iterNb   = -1
     self.datafile = open(datapath, newline='')
     self.data     = csv.DictReader(self.datafile, quoting=csv.QUOTE_NONNUMERIC)