]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Add MEDWriter tests to ctest and salome test.
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 5 Jan 2021 14:33:18 +0000 (15:33 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 5 Jan 2021 14:38:41 +0000 (15:38 +0100)
CTestTestfileInstall.cmake
src/Plugins/MEDWriter/plugin/CMakeLists.txt
src/Plugins/MEDWriter/plugin/Test/CMakeLists.txt [new file with mode: 0644]
src/Plugins/MEDWriter/plugin/Test/CTestTestfileInstall.cmake [new file with mode: 0644]
src/Plugins/MEDWriter/plugin/Test/tests.set [new file with mode: 0644]

index 508b6d5a088f21eee02bebde22fc07cd732d018d..bd44f007578e7f24fe1f4e20eee6aa4da63b7825 100644 (file)
@@ -18,3 +18,4 @@
 #
 
 SUBDIRS(MEDReader)
+SUBDIRS(MEDWriter)
index a542ce4002b177730f28ffc59723e32a754e1ea3..55f724d2dbd3857b216b08f3a0ab0a5818905966 100644 (file)
@@ -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 (file)
index 0000000..2cb5ddd
--- /dev/null
@@ -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 $<TARGET_FILE_DIR:MEDWriter>
+        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 (file)
index 0000000..a833063
--- /dev/null
@@ -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 (file)
index 0000000..5fa4bd9
--- /dev/null
@@ -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)