1 # Copyright (C) 2010-2015 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 SET(TEST_NUMBERS 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19)
22 SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDReader)
24 IF(KW_TESTING_PLATFORM)
26 FOREACH(tfile ${TEST_NUMBERS})
27 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py
28 DESTINATION ${TEST_INSTALL_DIRECTORY})
31 INSTALL(FILES CTestTestfileInstall.cmake
32 DESTINATION ${TEST_INSTALL_DIRECTORY}
33 RENAME CTestTestfile.cmake)
35 cmake_minimum_required(VERSION 2.7)
37 find_package(ParaView REQUIRED)
38 include(${PARAVIEW_USE_FILE})
40 include(ParaViewTestingMacros)
41 include(FindPythonModules)
43 include(${PROJECT_SOURCE_DIR}/testing/testFunctions.cmake)
44 set(PV_PLUGIN_PATH "${CMAKE_BINARY_DIR}/lib/")
50 set(PARAVIEW_BIN_DIR "${ParaView_DIR}/bin" CACHE PATH "ParaView binary path")
52 set(PVTEST_DRIVER "${PARAVIEW_BIN_DIR}/smTestDriver")
53 set(PARAVIEW_CLIENT "${PARAVIEW_BIN_DIR}/paraview")
54 set(PARAVIEW_SERVER "${PARAVIEW_BIN_DIR}/pvserver")
55 set(PVPYTHON "${PARAVIEW_BIN_DIR}/pvpython")
57 set(BASELINES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Baselines")
58 set(PYTHON_SCRIPTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
59 set(TEMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary")
62 SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDReader)
64 if(NOT EXISTS ${TEMP_DIR})
65 file(MAKE_DIRECTORY ${TEMP_DIR})
68 # Override vtk_add_test_* variables for use with ParaView.
69 macro (_myy_override_vtk_dirs)
70 set(VTK_TEST_DATA_DIR ${PYTHON_SCRIPTS_DIR})
71 set(VTK_BASELINE_DIR ${BASELINES_DIR})
72 set(VTK_TEST_OUTPUT_DIR ${TEMP_DIR})
73 set(VTK_TEST_DATA_TARGET ParaViewData)
76 function (myy_add_python_test)
77 message(STATUS "Add Python test for ${ARGV2}")
78 set(VTK_PYTHON_EXE "${PVPYTHON}")
79 list(APPEND VTK_PYTHON_ARGS -dr
80 ${PARAVIEW_PYTHON_ARGS})
81 _myy_override_vtk_dirs()
82 myvtk_add_test_python(${ARGN})
85 # Test all python scripts
86 file(GLOB scripts "${PYTHON_SCRIPTS_DIR}/*py")
87 foreach(file ${scripts})
88 get_filename_component(fname ${file} NAME)
93 DESTINATION ${TEST_INSTALL_DIRECTORY})
96 ELSE(KW_TESTING_PLATFORM)
98 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
100 FOREACH(tfile ${TEST_NUMBERS})
101 ADD_TEST(testMEDReader${tfile} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader${tfile}.py -B ${CMAKE_CURRENT_SOURCE_DIR}/Baselines )
102 SET_TESTS_PROPERTIES(testMEDReader${tfile} PROPERTIES ENVIRONMENT "${tests_env}")
105 ENDIF(KW_TESTING_PLATFORM)
107 INSTALL(FILES CTestTestfileInstall.cmake
108 DESTINATION ${TEST_INSTALL_DIRECTORY}
109 RENAME CTestTestfile.cmake)