From dcb53fe63ec020b19efee756c40bb036291f05b6 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 21 May 2020 15:34:42 +0300 Subject: [PATCH] Rearrange tests --- CMakeLists.txt | 49 ++++++++-------- CTestTestfileInstall.cmake | 1 + SalomeGEOMConfig.cmake.in | 1 - doc/salome/CMakeLists.txt | 8 ++- doc/salome/examples/CMakeLists.txt | 53 +++++++++++------- .../examples/CTestTestfileInstall.cmake | 4 +- doc/salome/examples/{GEOM_box.py => box.py} | 0 .../examples/{GEOM_Field.py => field.py} | 0 doc/salome/examples/testme.py | 56 ------------------- doc/salome/examples/tests.set | 12 ++-- doc/salome/gui/GEOM/input/geompy.doc | 2 +- doc/salome/gui/GEOM/input/tui_geom_field.doc | 2 +- src/GEOM_SWIG/CMakeLists.txt | 5 -- src/GEOM_SWIG/GEOM_shared_modules.py | 44 --------------- src/Tools/t_shape/CMakeLists.txt | 14 +++++ .../t_shape/CTestTestfileInstall.cmake} | 18 +++--- src/Tools/t_shape/t_shape_builder.py | 20 ------- src/Tools/t_shape/test_t_shape_builder.py | 23 ++++++++ src/XAO/tests/CMakeLists.txt | 9 +-- 19 files changed, 120 insertions(+), 201 deletions(-) rename doc/salome/examples/{GEOM_box.py => box.py} (100%) rename doc/salome/examples/{GEOM_Field.py => field.py} (100%) delete mode 100755 doc/salome/examples/testme.py delete mode 100644 src/GEOM_SWIG/GEOM_shared_modules.py rename src/{XAO/tests/data/CMakeLists.txt => Tools/t_shape/CTestTestfileInstall.cmake} (69%) create mode 100644 src/Tools/t_shape/test_t_shape_builder.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fd0bf212..aaf694e0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,27 +159,25 @@ SALOME_PACKAGE_REPORT_AND_CHECK() # Directories # (default values taken from KERNEL) # =========== -SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries") -SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs") -SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files") -SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers") +SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: executables") +SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: libraries") +SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: IDL files") +SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: headers") SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH - "Install path: SALOME scripts") + "Install path: scripts") SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH - "Install path: SALOME script data") + "Install path: script data") SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH - "Install path: SALOME Python scripts") -SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff") -SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH - "Install path: SALOME Python shared modules") -SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Install path: SALOME CMake files") + "Install path: Python modules") +SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: Python stuff") +SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Install path: CMake files") SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH - "Install path: local SALOME CMake files") + "Install path: local CMake files") SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH - "Install path: local SALOME config files (obsolete, to be removed)") + "Install config files (obsolete, to be removed)") -SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources") -SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation") +SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: resources") +SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: documentation") # Specific to GEOM: SET(SALOME_GEOM_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/geom" CACHE PATH @@ -191,15 +189,14 @@ SET(SALOME_GEOM_INSTALL_PLUGINS share/salome/plugins/geom CACHE PATH MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS) MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON) -MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES) -MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) +MARK_AS_ADVANCED(SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES) +MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON) MARK_AS_ADVANCED(SALOME_GEOM_INSTALL_RES_DATA SALOME_GEOM_INSTALL_RES_SCRIPTS SALOME_GEOM_INSTALL_PLUGINS) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) # Accumulate environment variables for GEOM module SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} - ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON} - ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}) + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON}) SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) # Sources @@ -210,9 +207,7 @@ ADD_SUBDIRECTORY(adm_local) ADD_SUBDIRECTORY(resources) ADD_SUBDIRECTORY(bin) ADD_SUBDIRECTORY(src) -IF(SALOME_BUILD_DOC) - ADD_SUBDIRECTORY(doc) -ENDIF() +ADD_SUBDIRECTORY(doc) # Header configuration # ==================== @@ -308,7 +303,9 @@ INSTALL(FILES INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" FILE ${PROJECT_NAME}Targets.cmake) -# Application tests -INSTALL(FILES CTestTestfileInstall.cmake - DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test - RENAME CTestTestfile.cmake) +IF(SALOME_BUILD_TESTS) + # Application tests + INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test + RENAME CTestTestfile.cmake) +ENDIF() diff --git a/CTestTestfileInstall.cmake b/CTestTestfileInstall.cmake index c5f9b6f6b..f878377e8 100644 --- a/CTestTestfileInstall.cmake +++ b/CTestTestfileInstall.cmake @@ -24,3 +24,4 @@ SET(TIMEOUT 300) SUBDIRS(examples) SUBDIRS(xao) +SUBDIRS(t_shape) \ No newline at end of file diff --git a/SalomeGEOMConfig.cmake.in b/SalomeGEOMConfig.cmake.in index 0f61a3024..59d224086 100644 --- a/SalomeGEOMConfig.cmake.in +++ b/SalomeGEOMConfig.cmake.in @@ -116,7 +116,6 @@ SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@") SET(SALOME_INSTALL_CMAKE "@SALOME_INSTALL_CMAKE@") SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@") SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@") -SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@") SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@") SET(SALOME_INSTALL_DOC "@SALOME_INSTALL_DOC@") SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@") diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt index ccc73ba43..95a1b4ed8 100644 --- a/doc/salome/CMakeLists.txt +++ b/doc/salome/CMakeLists.txt @@ -20,6 +20,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -ADD_SUBDIRECTORY(tui) -ADD_SUBDIRECTORY(gui) -ADD_SUBDIRECTORY(examples) \ No newline at end of file +ADD_SUBDIRECTORY(examples) +IF(SALOME_BUILD_DOC) + ADD_SUBDIRECTORY(tui) + ADD_SUBDIRECTORY(gui) +ENDIF() diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index e84dd2c4b..19857eb8b 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -19,31 +19,42 @@ INCLUDE(tests.set) -SET(TEST_REINIT_SALOME "False") SALOME_CONFIGURE_FILE(tests.py.in tests.py) -SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) +# Install examples -IF(GEOM_JOIN_TESTS) - ADD_TEST(NAME GEOM_examples COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py tests.py) -ELSE(GEOM_JOIN_TESTS) - FOREACH(test ${GOOD_TESTS}) - GET_FILENAME_COMPONENT(testname ${test} NAME_WE) - ADD_TEST(NAME ${testname} - COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${test}) - SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") - ENDFOREACH() -ENDIF(GEOM_JOIN_TESTS) - -# install Python scripts +SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS}) SALOME_INSTALL_SCRIPTS("${EXAMPLES_TESTS}" ${SALOME_INSTALL_DOC}/examples/GEOM) -# Application tests +# Tests + +IF(SALOME_BUILD_TESTS) + + SET(TEST_REINIT_SALOME "False") + SET(TEST_HELPER ${KERNEL_ROOT_DIR}/bin/salome/test_helper.py) + + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + + IF(GEOM_JOIN_TESTS) + ADD_TEST(NAME all_examples COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} tests.py) + ELSE(GEOM_JOIN_TESTS) + FOREACH(test ${GOOD_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() + ENDIF(GEOM_JOIN_TESTS) + + # Application tests + # Note: we don't install test scripts as they are already installed to the documentation folder + + SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/examples) -SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/examples) -INSTALL(FILES ${GOOD_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY}) + CONFIGURE_FILE(CTestTestfileInstall.cmake ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake + DESTINATION ${TEST_INSTALL_DIRECTORY} + RENAME CTestTestfile.cmake) + INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) -INSTALL(FILES CTestTestfileInstall.cmake - DESTINATION ${TEST_INSTALL_DIRECTORY} - RENAME CTestTestfile.cmake) -INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) +ENDIF(SALOME_BUILD_TESTS) diff --git a/doc/salome/examples/CTestTestfileInstall.cmake b/doc/salome/examples/CTestTestfileInstall.cmake index 47801265a..dc60e4810 100644 --- a/doc/salome/examples/CTestTestfileInstall.cmake +++ b/doc/salome/examples/CTestTestfileInstall.cmake @@ -17,11 +17,13 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +SET(TESTS_DIR "$ENV{GEOM_ROOT_DIR}/@SALOME_INSTALL_DOC@/examples/GEOM") + INCLUDE(tests.set) FOREACH(tfile ${GOOD_TESTS}) GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE) SET(TEST_NAME GEOM_${BASE_NAME}) - ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}) + ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${TESTS_DIR}/${tfile}) SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") ENDFOREACH() diff --git a/doc/salome/examples/GEOM_box.py b/doc/salome/examples/box.py similarity index 100% rename from doc/salome/examples/GEOM_box.py rename to doc/salome/examples/box.py diff --git a/doc/salome/examples/GEOM_Field.py b/doc/salome/examples/field.py similarity index 100% rename from doc/salome/examples/GEOM_Field.py rename to doc/salome/examples/field.py diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py deleted file mode 100755 index e5f71fb07..000000000 --- a/doc/salome/examples/testme.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE -# -# 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 unittest, sys, os - -class SalomeSession(object): - def __init__(self, script): - import runSalome - run_script = "runSalome.py" - if sys.platform == 'win32': - module_dir = os.getenv("KERNEL_ROOT_DIR") - if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script) - pass - sys.argv = [run_script] - sys.argv += ["--terminal"] - sys.argv += ["--modules=GEOM"] - sys.argv += ["%s" % script] - if sys.platform == 'win32': - main_module_path = sys.modules['__main__'].__file__ - sys.modules['__main__'].__file__ = '' - clt, d = runSalome.main() - if sys.platform == 'win32': - sys.modules['__main__'].__file__ = main_module_path - return - - def __del__(self): - port = os.getenv('NSPORT') - import killSalomeWithPort - killSalomeWithPort.killMyPort(port) - return - pass - -class MyTest(unittest.TestCase): - def testFunction(self): - SalomeSession(sys.argv[1]) - pass - -unittest.main(argv=sys.argv[:1]) diff --git a/doc/salome/examples/tests.set b/doc/salome/examples/tests.set index a43ed7a6a..4a0add9c0 100644 --- a/doc/salome/examples/tests.set +++ b/doc/salome/examples/tests.set @@ -26,6 +26,7 @@ SET(GOOD_TESTS advanced_geom_objs_ex01.py advanced_geom_objs_ex02.py advanced_geom_objs_ex03.py + advanced_geom_objs_smoothingsurface.py angle.py arranging_study_objects.py basic_geom_objs_ex01.py @@ -51,11 +52,13 @@ SET(GOOD_TESTS boolean_operations_ex03.py boolean_operations_ex04.py bounding_box.py + box.py building_by_blocks_ex01.py building_by_blocks_ex02.py center_of_mass.py check_compound_of_blocks.py check_self_intersections.py + check_self_intersections_fast.py check_shape.py complex_objs_ex01.py complex_objs_ex02.py @@ -69,17 +72,17 @@ SET(GOOD_TESTS complex_objs_ex10.py complex_objs_ex11.py fast_intersection.py + field.py free_boundaries.py free_faces.py - GEOM_box.py get_non_blocks.py import_export.py inertia.py min_distance.py normal_face.py notebook_geom.py - polyline.py point_coordinates.py + polyline.py primitives_ex01.py primitives_ex02.py primitives_ex03.py @@ -106,6 +109,7 @@ SET(GOOD_TESTS topological_geom_objs_ex04.py topological_geom_objs_ex05.py topological_geom_objs_ex06.py + topological_geom_objs_ex07.py transformation_operations_ex01.py transformation_operations_ex02.py transformation_operations_ex03.py @@ -131,8 +135,4 @@ SET(GOOD_TESTS working_with_groups_ex04.py working_with_groups_ex05.py working_with_groups_ex06.py - GEOM_Field.py - check_self_intersections_fast.py # OCC > 6.9.0 ) - -SET(EXAMPLES_TESTS ${BAD_TESTS} ${GOOD_TESTS} testme.py) diff --git a/doc/salome/gui/GEOM/input/geompy.doc b/doc/salome/gui/GEOM/input/geompy.doc index e6af9a43a..58e031801 100644 --- a/doc/salome/gui/GEOM/input/geompy.doc +++ b/doc/salome/gui/GEOM/input/geompy.doc @@ -16,7 +16,7 @@ linear documentation for geomBuilder.py \n \anchor tui_sample_geom_script

GEOM Python script example

-\tui_script{GEOM_box.py} +\tui_script{box.py} \n By the links below you can find sample scripts for all operations provided by Geometry module. diff --git a/doc/salome/gui/GEOM/input/tui_geom_field.doc b/doc/salome/gui/GEOM/input/tui_geom_field.doc index 79598bfab..d8f4d3116 100644 --- a/doc/salome/gui/GEOM/input/tui_geom_field.doc +++ b/doc/salome/gui/GEOM/input/tui_geom_field.doc @@ -1,6 +1,6 @@ /*! \page tui_geom_field_page Geometrical Fields -\tui_script{GEOM_Field.py} +\tui_script{field.py} */ diff --git a/src/GEOM_SWIG/CMakeLists.txt b/src/GEOM_SWIG/CMakeLists.txt index 4eaec4027..14bdf2c0b 100644 --- a/src/GEOM_SWIG/CMakeLists.txt +++ b/src/GEOM_SWIG/CMakeLists.txt @@ -114,14 +114,9 @@ SET(_python_VTK_SCRIPTS # scripts / shared -SET(_shared_SCRIPTS - GEOM_shared_modules.py - ) - # --- rules --- SALOME_INSTALL_SCRIPTS("${_other_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_DATA} DEF_PERMS) -SALOME_INSTALL_SCRIPTS("${_shared_SCRIPTS}" ${SALOME_INSTALL_PYTHON_SHARED} DEF_PERMS) SALOME_INSTALL_SCRIPTS("${_python_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/geom DEF_PERMS) # Install plugin scripts diff --git a/src/GEOM_SWIG/GEOM_shared_modules.py b/src/GEOM_SWIG/GEOM_shared_modules.py deleted file mode 100644 index e2ccd8c83..000000000 --- a/src/GEOM_SWIG/GEOM_shared_modules.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# 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 -# - -""" - -""" - -# force GEOM importation at interpretor initialization -# see salome_shared_modules.py -# (avoids incomplete import at run time) - -from launchConfigureParser import verbose - -if verbose(): print("============== import GEOM =======================") - -import GEOM - -# this function is required - -def init_shared_modules(): - """ - This function initializes shared modules that need to be - """ - pass diff --git a/src/Tools/t_shape/CMakeLists.txt b/src/Tools/t_shape/CMakeLists.txt index 9a81deab2..23df8088e 100644 --- a/src/Tools/t_shape/CMakeLists.txt +++ b/src/Tools/t_shape/CMakeLists.txt @@ -57,3 +57,17 @@ IF(SALOME_BUILD_GUI) # to avoid races problems when compiling in parallel ADD_DEPENDENCIES(${_target_name_pyuic_py} ${_target_name_pyuic}) ENDIF() + +IF(SALOME_BUILD_TESTS) + SET(TEST_HELPER ${KERNEL_ROOT_DIR}/bin/salome/test_helper.py) + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + ADD_TEST(NAME t_shape_builder + COMMAND ${PYTHON_EXECUTABLE} -B ${TEST_HELPER} ${CMAKE_CURRENT_SOURCE_DIR}/test_t_shape_builder.py) + + SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/t_shape) + INSTALL(FILES test_t_shape_builder.py DESTINATION ${TEST_INSTALL_DIRECTORY}) + + INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${TEST_INSTALL_DIRECTORY} + RENAME CTestTestfile.cmake) +ENDIF() diff --git a/src/XAO/tests/data/CMakeLists.txt b/src/Tools/t_shape/CTestTestfileInstall.cmake similarity index 69% rename from src/XAO/tests/data/CMakeLists.txt rename to src/Tools/t_shape/CTestTestfileInstall.cmake index d4d9e9f24..40dbf6880 100644 --- a/src/XAO/tests/data/CMakeLists.txt +++ b/src/Tools/t_shape/CTestTestfileInstall.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2020 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2015-2020 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,13 +17,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(XAO_DATA_FILES - Box_1.brep - Box_2.brep - Cut_2.brep - test.xao - ) +SET(TESTS test_t_shape_builder.py) -# --- rules --- -SET(XAO_DATA_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao/data) -INSTALL(FILES ${XAO_DATA_FILES} DESTINATION ${XAO_DATA_DIR}) +FOREACH(tfile ${TESTS}) + GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE) + SET(TEST_NAME GEOM_${BASE_NAME}) + ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} 1000 ${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") +ENDFOREACH() diff --git a/src/Tools/t_shape/t_shape_builder.py b/src/Tools/t_shape/t_shape_builder.py index cd6c61166..b44ffb74c 100644 --- a/src/Tools/t_shape/t_shape_builder.py +++ b/src/Tools/t_shape/t_shape_builder.py @@ -381,23 +381,3 @@ def jonction(r1, r2, h1, h2, a1): faci.append(geompy.MakeFaceWires([ed90[3], ed90[7], ed90[4], lord90[2]], 0)) return faci, sect45, arc1, l1, lord90, lord45, edges, arcextru - -def test_t_shape_builder(): - """For testing purpose""" - salome.salome_init() - geompy = geomBuilder.New() - for r1 in [1., 100.]: - for r2 in [0.9*r1, 0.5*r1, 0.1*r1, 0.05*r1]: - for thickness in [r1/100., r1/10., r1/2.]: - print(r1, r2, thickness) - h1 = r1 * 2.0 - h2 = h1 - try: - res = build_shape(r1, r2, h1, h2, thickness) - geompy.addToStudy(res, "res_%f_%f_%f"%(r1,r2, thickness)) - except: - print("problem with res_%f_%f_%f"%(r1,r2, thickness)) - -if __name__=="__main__": - """For testing purpose""" - test_t_shape_builder() diff --git a/src/Tools/t_shape/test_t_shape_builder.py b/src/Tools/t_shape/test_t_shape_builder.py new file mode 100644 index 000000000..1ce36c105 --- /dev/null +++ b/src/Tools/t_shape/test_t_shape_builder.py @@ -0,0 +1,23 @@ +import salome +salome.salome_init() + +from salome.geom import geomBuilder +geompy = geomBuilder.New() + +from salome.geom.t_shape.t_shape_builder import build_shape +num_errors = 0 + +for r1 in [1., 100.]: + for r2 in [0.9*r1, 0.5*r1, 0.1*r1, 0.05*r1]: + for thickness in [r1/100., r1/10., r1/2.]: + print(r1, r2, thickness) + h1 = r1 * 2.0 + h2 = h1 + try: + res = build_shape(r1, r2, h1, h2, thickness) + geompy.addToStudy(res, "res_%f_%f_%f"%(r1, r2, thickness)) + except: + print("problem with res_%f_%f_%f"%(r1, r2, thickness)) + num_errors += 1 +if num_errors > 0: + raise RuntimeError("Error: 1 or more test cases failed!") diff --git a/src/XAO/tests/CMakeLists.txt b/src/XAO/tests/CMakeLists.txt index d6c14f782..4ce6ec83d 100644 --- a/src/XAO/tests/CMakeLists.txt +++ b/src/XAO/tests/CMakeLists.txt @@ -17,8 +17,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -ADD_SUBDIRECTORY(data) - # additional include directories INCLUDE_DIRECTORIES( ${PTHREAD_INCLUDE_DIR} @@ -53,20 +51,19 @@ SET(TestXAO_SOURCES # --- rules --- +SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao) + ADD_EXECUTABLE(TestXAO ${TestXAO_SOURCES}) TARGET_LINK_LIBRARIES(TestXAO ${_link_LIBRARIES}) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao) - ADD_TEST(TestXAO TestXAO) SET_TESTS_PROPERTIES(TestXAO PROPERTIES ENVIRONMENT "XAO_DATA_DIR=${CMAKE_CURRENT_SOURCE_DIR}/data;${tests_env}") -INSTALL(TARGETS TestXAO DESTINATION ${SALOME_INSTALL_BINS}) - # Application tests INSTALL(TARGETS TestXAO RUNTIME DESTINATION ${TEST_INSTALL_DIRECTORY}) +INSTALL(DIRECTORY data DESTINATION ${TEST_INSTALL_DIRECTORY}) INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} -- 2.39.2