From: vsr Date: Mon, 25 May 2020 16:58:35 +0000 (+0300) Subject: Rearrange tests X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a257833128f8cf5d7d102f2948be36dbff512326;p=plugins%2Fgmshplugin.git Rearrange tests --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ff16b06..04868ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,12 +142,6 @@ IF(EXISTS ${SMESH_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module") ENDIF(NOT SALOME_SMESH_BUILD_GUI) ENDIF(SALOME_BUILD_GUI) - IF(SALOME_BUILD_DOC) - IF(NOT SALOME_SMESH_BUILD_DOC) - MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build GMSHPLUGIN documentation. " - "So, you should either set SALOME_BUILD_DOC=OFF in GMSHPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.") - ENDIF(NOT SALOME_SMESH_BUILD_DOC) - ENDIF(SALOME_BUILD_DOC) ELSE(EXISTS ${SMESH_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR") ENDIF(EXISTS ${SMESH_ROOT_DIR}) @@ -213,9 +207,7 @@ ADD_SUBDIRECTORY(bin) IF(SALOME_BUILD_TESTS) ADD_SUBDIRECTORY(tests) ENDIF(SALOME_BUILD_TESTS) -IF(SALOME_BUILD_DOC) - ADD_SUBDIRECTORY(doc) -ENDIF(SALOME_BUILD_DOC) +ADD_SUBDIRECTORY(doc) # Header configuration # ==================== @@ -274,3 +266,12 @@ INSTALL(FILES # Install the export set for use with the install-tree INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" FILE ${PROJECT_NAME}Targets.cmake) + +IF(SALOME_BUILD_TESTS) + CONFIGURE_FILE(CTestTestfileInstall.cmake + ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake + @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake + DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS} + RENAME CTestTestfile.cmake) +ENDIF() diff --git a/CTestTestfileInstall.cmake b/CTestTestfileInstall.cmake new file mode 100644 index 0000000..ae83423 --- /dev/null +++ b/CTestTestfileInstall.cmake @@ -0,0 +1,36 @@ +# Copyright (C) 2012-2015 ALNEOS +# Copyright (C) 2016-2020 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.alneos.com/ or email : contact@alneos.fr +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SET(TESTS_DIR "$ENV{GMSHPLUGIN_ROOT_DIR}/@SALOME_INSTALL_DOC@/examples/GMSHPLUGIN") + +INCLUDE(tests.set) +INCLUDE(examples.set) + +SET(COMPONENT_NAME GMSHPLUGIN) +SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") +SET(TIMEOUT 300) + +FOREACH(tfile ${TEST_SCRIPTS} ${EXAMPLE_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + SET(TEST_NAME "${COMPONENT_NAME}_${TEST_NAME}") + 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/CMakeLists.txt b/doc/salome/CMakeLists.txt index fc08592..76372b3 100644 --- a/doc/salome/CMakeLists.txt +++ b/doc/salome/CMakeLists.txt @@ -20,4 +20,6 @@ # ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(gui) \ No newline at end of file +IF(SALOME_BUILD_DOC) + ADD_SUBDIRECTORY(gui) +ENDIF() diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index 5d50b97..361e88a 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -19,33 +19,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py") -#INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) - INCLUDE(examples.set) -SET(COMPONENT_NAME GMSHPLUGIN) -SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) +# Install examples + +INSTALL(FILES ${EXAMPLE_SCRIPTS} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) + +# Tests -SET(TEST_INSTALL_DIRECTORY ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +IF(SALOME_BUILD_TESTS) + # make test -# make test -SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + SET(SALOME_TEST_DRIVER "${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") + SET(TIMEOUT 300) + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -FOREACH(tfile ${EXAMPLE_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py) - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") - INSTALL(FILES ${tfile}.py DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) -ENDFOREACH() + FOREACH(tfile ${EXAMPLE_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + ADD_TEST(NAME ${TEST_NAME} + COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() -# salome test -FOREACH(tfile ${EXAMPLE_NAMES}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py - DESTINATION ${TEST_INSTALL_DIRECTORY}) -ENDFOREACH() + # salome test -INSTALL(FILES examples.set DESTINATION ${TEST_INSTALL_DIRECTORY}) \ No newline at end of file + INSTALL(FILES examples.set DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +ENDIF() diff --git a/doc/salome/examples/examples.set b/doc/salome/examples/examples.set index be7acf9..8d34b4b 100644 --- a/doc/salome/examples/examples.set +++ b/doc/salome/examples/examples.set @@ -19,6 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(EXAMPLE_NAMES - gmshdemo +SET(EXAMPLE_SCRIPTS + gmshdemo.py ) diff --git a/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt b/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt index 7c20c53..f3bbd49 100644 --- a/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt +++ b/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt @@ -24,8 +24,8 @@ SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py) SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html) -SET(smesh_file "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py") -SET(kernel_file "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") +SET(smesh_file "${SMESH_ROOT_DIR}/bin/salome/collect_mesh_methods.py") +SET(kernel_file "${KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") SET(ADD_VAR) LIST(APPEND ADD_VAR SMESH_MeshersList=GMSHPlugin) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 286daed..25d2186 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,31 +21,27 @@ INCLUDE(tests.set) -SET(COMPONENT_NAME GMSHPLUGIN) -SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) - -SET(TEST_INSTALL_DIRECTORY ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) - -# make test -SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - -FOREACH(tfile ${TEST_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py) - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") -ENDFOREACH() - -# salome test -FOREACH(tfile ${TEST_NAMES}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py - DESTINATION ${TEST_INSTALL_DIRECTORY}) -ENDFOREACH() - -INSTALL(FILES CTestTestfileInstall.cmake - DESTINATION ${TEST_INSTALL_DIRECTORY} - RENAME CTestTestfile.cmake) - -INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) \ No newline at end of file +# Install tests + +INSTALL(FILES ${TEST_SCRIPTS} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) + +# Tests + +IF(SALOME_BUILD_TESTS) + # make test + + SET(SALOME_TEST_DRIVER "${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") + SET(TIMEOUT 300) + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + + FOREACH(tfile ${TEST_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + ADD_TEST(NAME ${TEST_NAME} + COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() + + # salome test + + INSTALL(FILES tests.set DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +ENDIF() diff --git a/tests/CTestTestfileInstall.cmake b/tests/CTestTestfileInstall.cmake deleted file mode 100644 index adbf212..0000000 --- a/tests/CTestTestfileInstall.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2012-2015 ALNEOS -# Copyright (C) 2016-2020 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.alneos.com/ or email : contact@alneos.fr -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -INCLUDE(tests.set) -INCLUDE(examples.set) - -SET(COMPONENT_NAME GMSHPLUGIN) -SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) - - -FOREACH(tfile ${TEST_NAMES} ${EXAMPLE_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py) - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") -ENDFOREACH() diff --git a/tests/tests.set b/tests/tests.set index f089c71..5f4d23c 100644 --- a/tests/tests.set +++ b/tests/tests.set @@ -19,6 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(TEST_NAMES - basicGroup +SET(TEST_SCRIPTS + basicGroup.py )