From: Christophe Bourcier Date: Tue, 5 Jan 2021 14:33:18 +0000 (+0100) Subject: Add MEDWriter tests to ctest and salome test. X-Git-Tag: V9_7_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0996b4828859fd1dc0b08253b8f07fcfe36c08f5;p=modules%2Fparavis.git Add MEDWriter tests to ctest and salome test. --- diff --git a/CTestTestfileInstall.cmake b/CTestTestfileInstall.cmake index 508b6d5a..bd44f007 100644 --- a/CTestTestfileInstall.cmake +++ b/CTestTestfileInstall.cmake @@ -18,3 +18,4 @@ # SUBDIRS(MEDReader) +SUBDIRS(MEDWriter) diff --git a/src/Plugins/MEDWriter/plugin/CMakeLists.txt b/src/Plugins/MEDWriter/plugin/CMakeLists.txt index a542ce40..55f724d2 100644 --- a/src/Plugins/MEDWriter/plugin/CMakeLists.txt +++ b/src/Plugins/MEDWriter/plugin/CMakeLists.txt @@ -59,3 +59,7 @@ install(TARGETS MEDWriterPlugin LIBRARY DESTINATION lib/paraview ARCHIVE DESTINATION lib/paraview ) + +if (SALOME_BUILD_TESTS OR BUILD_TESTING) + add_subdirectory(Test) +endif() diff --git a/src/Plugins/MEDWriter/plugin/Test/CMakeLists.txt b/src/Plugins/MEDWriter/plugin/Test/CMakeLists.txt new file mode 100644 index 00000000..2cb5ddd2 --- /dev/null +++ b/src/Plugins/MEDWriter/plugin/Test/CMakeLists.txt @@ -0,0 +1,85 @@ +# Copyright (C) 2010-2020 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 (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + + ########################### + # Tests for standalone mode + ########################### + + if (PARAVIEW_ENABLE_PYTHON) + file(GLOB pythonTests *.py) + foreach(testFullPath ${pythonTests}) + get_filename_component(testFile ${testFullPath} NAME) + paraview_add_test_python(NO_RT DIRECT_DATA ${testFile}) + get_filename_component(testName ${testFile} NAME_WE) + set_tests_properties(Python-${testName} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${QT5_ROOT_DIR}/lib/:${MEDCOUPLING_ROOT_DIR}/lib/:${MEDFILE_ROOT_DIR}/lib/:${HDF5_ROOT_DIR}/lib:${PYTHON_ROOT_DIR}/lib;PYTHONPATH=${MEDCOUPLING_ROOT_DIR}/lib/python3.6/site-packages/;PV_PLUGIN_PATH=${CMAKE_BINARY_DIR}/lib/paraview-5.8/plugins/MEDWriter;PARAVIEW_BIN_DIR=${ParaView_DIR}/bin/") + endforeach() + endif() + + if(PARAVIEW_USE_QT) + file(GLOB xmlTests *.xml) + foreach(testFullPath ${xmlTests}) + get_filename_component(testFile ${testFullPath} NAME) + get_filename_component(testName ${testFile} NAME_WE) + set (${testName}_USES_DIRECT_DATA ON) + paraview_add_client_tests( + LOAD_PLUGIN MEDWriter + PLUGIN_PATH $ + TEST_SCRIPTS ${testFile}) + set_tests_properties(pv.${testName} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${QT5_ROOT_DIR}/lib/:${MEDCOUPLING_ROOT_DIR}/lib/:${MEDFILE_ROOT_DIR}/lib/:${HDF5_ROOT_DIR}/lib:${PYTHON_ROOT_DIR}/lib") + endforeach() + endif() + +else() + + ######################## + # Tests for PARAVIS mode + ######################## + + include(tests.set) + + salome_generate_tests_environment(tests_env) + + IF(SALOME_PARAVIS_NO_VISU_TESTS) + SET(_other_options "-D") + ENDIF() + + foreach(tfile ${TEST_NUMBERS}) + add_test(Python-TestMEDWriter${tfile} + ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/TestMEDWriter${tfile}.py + ${_other_options}) + set_tests_properties(Python-TestMEDWriter${tfile} PROPERTIES ENVIRONMENT "${tests_env}") + endforeach() + + # Application tests + set(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDWriter) + foreach(tfile ${TEST_NUMBERS}) + install(FILES TestMEDWriter${tfile}.py + DESTINATION ${TEST_INSTALL_DIRECTORY}) + endforeach() + + install(FILES tests.set + DESTINATION ${TEST_INSTALL_DIRECTORY}) + install(FILES CTestTestfileInstall.cmake + DESTINATION ${TEST_INSTALL_DIRECTORY} + RENAME CTestTestfile.cmake) + +endif() diff --git a/src/Plugins/MEDWriter/plugin/Test/CTestTestfileInstall.cmake b/src/Plugins/MEDWriter/plugin/Test/CTestTestfileInstall.cmake new file mode 100644 index 00000000..a8330631 --- /dev/null +++ b/src/Plugins/MEDWriter/plugin/Test/CTestTestfileInstall.cmake @@ -0,0 +1,29 @@ +# Copyright (C) 2015-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 +# + +INCLUDE(tests.set) + +SET(COMPONENT_NAME MEDWRITER) +SET(TIMEOUT 60) + +FOREACH(tfile ${TEST_NUMBERS}) + SET(TEST_NAME MEDWRITER_${tfile}) + ADD_TEST(${TEST_NAME} python TestMEDWriter${tfile}.py) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT}) +ENDFOREACH() diff --git a/src/Plugins/MEDWriter/plugin/Test/tests.set b/src/Plugins/MEDWriter/plugin/Test/tests.set new file mode 100644 index 00000000..5fa4bd93 --- /dev/null +++ b/src/Plugins/MEDWriter/plugin/Test/tests.set @@ -0,0 +1,30 @@ +# Copyright (C) 2017-2020 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 +# + +# This file declares a shared set of MEDWRITER tests, used by two test +# approaches: "make test" and "salome test". The former is used just after +# MEDWRITER build step, the latter is used from an installed SALOME application. +# +# We here initialize a cmake variable that is used, by file inclusion, in +# CMakeLists.txt (for make test) and CTestTestfileInstall.cmake (for salome +# test). +# This variables is: TEST_NUMBERS. +# Additional variables might be defined if necessary. + +SET(TEST_NUMBERS 0 1)