Salome HOME
Copyright update 2022
[modules/shaper.git] / src / ExchangePlugin / Test / CMakeLists.txt
1 # Copyright (C) 2021-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 include(tests.set)
21
22 ADD_UNIT_TESTS(${TEST_NAMES})
23
24 if(${HAVE_SALOME})
25   enable_testing()
26   set(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ExchangePlugin")
27   
28   install(FILES CTestTestfileInstall.cmake
29           DESTINATION ${TEST_INSTALL_DIRECTORY}
30           RENAME CTestTestfile.cmake)
31   install(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
32   
33   set(TMP_TESTS_NAMES)
34   foreach(tfile ${TEST_NAMES})
35     list(APPEND TMP_TESTS_NAMES "${tfile}")
36   endforeach(tfile ${TEST_NAMES})
37   
38   # tests which require SALOME GUI
39   include(tests_gui.set)
40   SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
41   set(COMPONENT_NAME "ExchangePlugin")
42   foreach(tfile ${TEST_WITH_GUI_NAMES})
43     # Strip the ".py" suffix
44     get_filename_component(TEST_NAME ${tfile} NAME_WE)
45     # -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py
46     set(TEST_NAME ${COMPONENT_NAME}_${TEST_NAME})
47     add_test(NAME ${TEST_NAME}
48              COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/testme.py ${CMAKE_CURRENT_SOURCE_DIR}/${tfile})
49     set_tests_properties(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env};SHAPER_UNIT_TEST_IN_PROGRESS=1")
50     set_tests_properties(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
51
52     # salome test
53     list(APPEND TMP_TESTS_NAMES "${tfile}")
54   endforeach()
55
56   install(FILES ${TMP_TESTS_NAMES} DESTINATION ${TEST_INSTALL_DIRECTORY})
57
58   install(FILES testme.py DESTINATION ${TEST_INSTALL_DIRECTORY}
59                           PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
60                                       GROUP_READ GROUP_EXECUTE
61                                       WORLD_READ WORLD_EXECUTE)
62
63   install(FILES tests_gui.set DESTINATION ${TEST_INSTALL_DIRECTORY})
64   install(DIRECTORY data DESTINATION ${TEST_INSTALL_DIRECTORY})
65 endif(${HAVE_SALOME})