Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Plugins / MEDWriter / plugin / Test / CMakeLists.txt
1 # Copyright (C) 2010-2022  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 if (CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
21   
22   ###########################
23   # Tests for standalone mode
24   ###########################
25
26   if (PARAVIEW_ENABLE_PYTHON)
27     file(GLOB pythonTests *.py)
28     foreach(testFullPath ${pythonTests})
29       get_filename_component(testFile ${testFullPath} NAME)
30       paraview_add_test_python(NO_RT DIRECT_DATA ${testFile})
31       get_filename_component(testName ${testFile} NAME_WE)
32       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/")
33     endforeach()
34   endif()
35
36   if(PARAVIEW_USE_QT)
37     file(GLOB xmlTests *.xml)
38     foreach(testFullPath ${xmlTests})
39       get_filename_component(testFile ${testFullPath} NAME)
40       get_filename_component(testName ${testFile} NAME_WE)
41       set (${testName}_USES_DIRECT_DATA ON)
42       paraview_add_client_tests(
43         LOAD_PLUGIN MEDWriter
44         PLUGIN_PATH $<TARGET_FILE_DIR:MEDWriter>
45         TEST_SCRIPTS ${testFile})
46         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")
47     endforeach()
48   endif()
49
50 else()
51
52   ########################
53   # Tests for PARAVIS mode
54   ########################
55
56   include(tests.set)
57
58   salome_generate_tests_environment(tests_env)
59
60   IF(SALOME_PARAVIS_NO_VISU_TESTS)
61     SET(_other_options "-D")
62   ENDIF()
63
64   foreach(tfile ${TEST_NUMBERS})
65     add_test(Python-TestMEDWriter${tfile}
66              ${PYTHON_EXECUTABLE}
67              ${CMAKE_CURRENT_SOURCE_DIR}/TestMEDWriter${tfile}.py
68              ${_other_options})
69     set_tests_properties(Python-TestMEDWriter${tfile} PROPERTIES ENVIRONMENT "${tests_env}")
70   endforeach()
71
72   # Application tests
73   set(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDWriter)
74   foreach(tfile ${TEST_NUMBERS})
75     install(FILES TestMEDWriter${tfile}.py
76             DESTINATION ${TEST_INSTALL_DIRECTORY})
77   endforeach()
78
79   install(FILES tests.set
80           DESTINATION ${TEST_INSTALL_DIRECTORY})
81   install(FILES CTestTestfileInstall.cmake
82           DESTINATION ${TEST_INSTALL_DIRECTORY}
83           RENAME CTestTestfile.cmake)
84
85 endif()