ADD_CUSTOM_TARGET(run_compatibility_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "tests_compatibility")
ENDIF(ADD_COMPATIBILITY_TESTS)
+IF(ADD_HDF_TESTS)
+ ADD_SUBDIRECTORY (test.hdfs)
+ENDIF(ADD_HDF_TESTS)
+
IF(SHAPER_BUILD_DOC)
INCLUDE(FindSphinx)
ADD_SUBDIRECTORY (doc)
CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=${USE_TEST_COVERAGE:-OFF}"
CMAKE_ARGS="${CMAKE_ARGS} -DADD_MODELS_TESTS=${ADD_MODELS_TESTS:-FALSE}"
CMAKE_ARGS="${CMAKE_ARGS} -DADD_COMPATIBILITY_TESTS=${ADD_COMPATIBILITY_TESTS:-FALSE}"
+CMAKE_ARGS="${CMAKE_ARGS} -DADD_HDF_TESTS=${ADD_HDF_TESTS:-FALSE}"
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${SHAPER_ROOT_DIR}"
CMAKE_ARGS="${CMAKE_ARGS} ${SOURCES_DIR}"
--- /dev/null
+# Copyright (C) 2014-2019 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
+#
+
+ENABLE_TESTING()
+
+SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
+
+if (EXISTS ${RESTRICTED_ROOT_DIR})
+ file(GLOB hdfFilesRestr "${RESTRICTED_ROOT_DIR}/SHAPER/test.hdfs/*.hdf")
+
+ if (WIN32) # different separators and path to libraries variable name
+ SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};$ENV{PATH}")
+ STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
+ STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
+ STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
+ STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
+ else()
+ SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
+ SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
+ endif()
+
+ foreach(eachFilePath ${hdfFilesRestr})
+ # Strip the ".hdf" suffix
+ GET_FILENAME_COMPONENT(aTestName ${eachFilePath} NAME_WE)
+
+ # Add "SubprojectName_" prefix
+ GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+ SET(aTestName "${aSubprojectName}_${aTestName}")
+
+ # Full path to the python test file being executed
+ SET(aTestFilePath "${eachFilePath}")
+ IF(EXISTS ${aTestFilePath})
+ ADD_TEST(NAME ${aTestName} COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/test.py" "$ENV{KERNEL_ROOT_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${aTestFilePath}")
+ if (WIN32) # different path to libraries variable name
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH}"
+ LABELS "models_hdf")
+ else()
+ SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH}"
+ LABELS "models_hdf")
+ endif()
+ # Debug output...
+ # MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFilePath}")
+ ELSE(EXISTS ${aTestFilePath})
+ MESSAGE(WARNING "Can not find the test file: ${aTestFilePath}")
+ ENDIF(EXISTS ${aTestFilePath})
+ endforeach(eachFilePath ${ARGN})
+
+ ADD_CUSTOM_TARGET(run_hdf_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -L "models_hdf")
+endif()
--- /dev/null
+# Copyright (C) 2014-2019 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 __name__ == "__main__":
+ model.testNbResults(aPartFeature, 1)
+ model.testNbSubResults(aPartFeature, [0])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936])
+ model.testResultsVolumes(aPartFeature, [1429610.103267467])
--- /dev/null
+# Copyright (C) 2014-2019 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 __name__ == "__main__":
+ model.testNbResults(aPartFeature, 1)
+ model.testNbSubResults(aPartFeature, [0])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936])
+ model.testResultsVolumes(aPartFeature, [1429610.103267467])
--- /dev/null
+# Copyright (C) 2014-2019 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 __name__ == "__main__":
+ model.testNbResults(aPartFeature, 1)
+ model.testNbSubResults(aPartFeature, [0])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936])
+ model.testResultsVolumes(aPartFeature, [1429610.103267467])
--- /dev/null
+# Copyright (C) 2014-2019 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 __name__ == "__main__":
+ model.testNbResults(aPartFeature, 1)
+ model.testNbSubResults(aPartFeature, [0])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936])
+ model.testResultsVolumes(aPartFeature, [1429610.103267467])
--- /dev/null
+#!/usr/bin/env python
+if __name__ == '__main__':
+
+ from subprocess import Popen
+ from time import sleep
+ import sys, os
+
+ salomeKernelDir = sys.argv[1]
+ sourceDir = sys.argv[2]
+ testfile = sys.argv[3]
+
+ portlogfile = os.getcwd() + "/.salome_port"
+ testlogfile = os.getcwd() + "/test.log"
+ # remove port file if any
+ try:
+ os.remove(portlogfile)
+ except:
+ pass
+
+ proc = Popen([salomeKernelDir + "/bin/salome/runSalome.py", "--modules", "SHAPER,GEOM", "--gui", "--ns-port-log=" + portlogfile, sourceDir + "/test_hdf.py", "args:" + testfile + "," + portlogfile + "," + testlogfile + "," + salomeKernelDir + "," + sourceDir])
+
+ iter = 0
+ while not os.path.exists(portlogfile) and iter < 100:
+ sleep(0.1)
+ iter += 1
+
+ while os.path.exists(portlogfile):
+ sleep(0.1)
+
+ isOk = True
+ with open(testlogfile, 'r') as inputFile:
+ s = inputFile.read()
+ print(s)
+ for line in s:
+ isOk = isOk and s.find("FAIL") < 0
+ try:
+ os.remove(testlogfile)
+ except:
+ pass
+
+ assert isOk, "Test failed"
--- /dev/null
+# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import salome, os, sys
+import SalomePyQt
+
+import unittest
+import subprocess
+
+import ModelHighAPI, ModelAPI, PartSetAPI
+from GeomAPI import GeomAPI_Shape
+from salome.shaper import model
+
+class TestHDF(unittest.TestCase):
+ testfile = ""
+ reffile = ""
+
+ def setUp(self):
+ salome.salome_close()
+
+ # leave file name only (trim path and extension)
+ fileName = os.path.basename(self.testfile)
+ self.reffile = self.reffile + "/" + os.path.splitext(fileName)[0] + ".py"
+
+ salome.salome_init(self.testfile, embedded=1)
+ myStudyName = salome.myStudy._get_Name()
+ self.session = salome.naming_service.Resolve('/Kernel/Session')
+ self.session.emitMessage("connect_to_study")
+
+ self.sg = SalomePyQt.SalomePyQt()
+ self.sg.activateModule("Shaper")
+ self.session = ModelAPI.ModelAPI_Session.get()
+ self.partSet = self.session.moduleDocument()
+
+ def tearDown(self):
+ salome.sg.UpdateView()
+ self.sg.processEvents()
+ salome.sg.FitAll()
+
+ def test_hdf_file(self):
+ self.assertTrue(self.partSet.size("Parts") > 0)
+ aPartsList = []
+ for aPartIndex in range(self.partSet.size("Parts")):
+ self.session.startOperation()
+ aPart = ModelAPI.modelAPI_ResultPart(ModelAPI.objectToResult(self.partSet.object("Parts", aPartIndex)))
+ aPart.activate()
+ self.session.finishOperation()
+
+ aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True))
+ # check reference data
+ exec(open(self.reffile, "rb").read())
+
+
+if __name__ == "__main__":
+ if len(sys.argv) > 1:
+ TestHDF.testfile = sys.argv[1]
+ if len(sys.argv) > 2:
+ salomePortFile = sys.argv[2]
+ if len(sys.argv) > 3:
+ sys.stderr = open(sys.argv[3], 'w')
+ if len(sys.argv) > 4:
+ salomeKernelDir = sys.argv[4]
+ if len(sys.argv) > 5:
+ TestHDF.reffile = sys.argv[5]
+
+ aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF)
+ unittest.TextTestRunner(stream=sys.stderr).run(aTest)
+
+# test_program = unittest.main(argv=[sys.argv[0]], exit=False)
+ proc = subprocess.Popen(salomeKernelDir + "/bin/salome/killSalome.py")
+
+ try:
+ os.remove(salomePortFile)
+ except:
+ print("Cannot remove file", file=f)
+
+# assert test_program.result.wasSuccessful(), "Test failed"
--- /dev/null
+# Copyright (C) 2014-2019 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 __name__ == "__main__":
+ model.testNbResults(aPartFeature, 1)
+ model.testNbSubResults(aPartFeature, [0])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.SOLID, [30])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.FACE, [231])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.EDGE, [968])
+ model.testNbSubShapes(aPartFeature, GeomAPI_Shape.VERTEX, [1936])
+ model.testResultsVolumes(aPartFeature, [1429610.103267467])