From: Cédric Aguerre Date: Mon, 19 Jun 2017 11:02:01 +0000 (+0200) Subject: Share test definition X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=debdf4a36c2099b4604220de277008158dbeb263;p=tools%2Fmedcoupling.git Share test definition --- diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index ed16b3523..c24236b7c 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2016 CEA/DEN, EDF R&D +# Copyright (C) 2012-2017 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 @@ -17,6 +17,8 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +INCLUDE(tests.set) + INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) @@ -37,17 +39,8 @@ SET (MEDCoupling_SWIG_DPYS_FILES MEDCouplingTypemaps.i) SET (MC_pyTestFiles - MEDCouplingBasicsTest1.py - MEDCouplingBasicsTest2.py - MEDCouplingBasicsTest3.py - MEDCouplingBasicsTest4.py - MEDCouplingBasicsTest5.py - MEDCouplingBasicsTest6.py - MEDCouplingIntersectTest.py - MEDCouplingRemapperTest.py + ${ALL_TESTS} MEDCouplingDataForTest.py - MEDCouplingNumPyTest.py - MEDCouplingPickleTest.py ) SET (MC_Swig_interf @@ -123,40 +116,28 @@ SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON}) INSTALL(FILES ${MC_Swig_interf} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) INSTALL(FILES ${MC_pyTestFiles} DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) -INSTALL(FILES MEDCouplingExamplesTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -ADD_TEST(MEDCouplingBasicsTest1 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest1.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest1 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingBasicsTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest2.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest2 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingBasicsTest3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest3.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest3 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingBasicsTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest4.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest4 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingBasicsTest5 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest5.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest5 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingBasicsTest6 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest6.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest6 PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingIntersectTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingIntersectTest.py) -SET_TESTS_PROPERTIES(MEDCouplingIntersectTest PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py) -SET_TESTS_PROPERTIES(MEDCouplingExamplesTest PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(MEDCouplingRemapperTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingRemapperTest.py) -SET_TESTS_PROPERTIES(MEDCouplingRemapperTest PROPERTIES ENVIRONMENT "${tests_env}") +FOREACH(test ${BASE_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") +ENDFOREACH() IF(NUMPY_FOUND) - ADD_TEST(MEDCouplingNumPyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumPyTest.py) - SET_TESTS_PROPERTIES(MEDCouplingNumPyTest PROPERTIES ENVIRONMENT "${tests_env}") - ADD_TEST(MEDCouplingPickleTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingPickleTest.py) - SET_TESTS_PROPERTIES(MEDCouplingPickleTest PROPERTIES ENVIRONMENT "${tests_env}") + FOREACH(test ${NUMPY_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() ENDIF(NUMPY_FOUND) # Application tests SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/MEDCoupling_Swig) -LIST(APPEND MC_pyTestFiles MEDCouplingExamplesTest.py) INSTALL(FILES ${MC_pyTestFiles} DESTINATION ${TEST_INSTALL_DIRECTORY}) INSTALL(FILES CTestTestfileInstall.cmake diff --git a/src/MEDCoupling_Swig/CTestTestfileInstall.cmake b/src/MEDCoupling_Swig/CTestTestfileInstall.cmake index ea92e59d7..d336cd942 100644 --- a/src/MEDCoupling_Swig/CTestTestfileInstall.cmake +++ b/src/MEDCoupling_Swig/CTestTestfileInstall.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D +# Copyright (C) 2015-2017 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 @@ -17,24 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(TEST_NAMES - MEDCouplingBasicsTest1 - MEDCouplingBasicsTest2 - MEDCouplingBasicsTest3 - MEDCouplingBasicsTest4 - MEDCouplingBasicsTest5 - MEDCouplingBasicsTest6 - MEDCouplingIntersectTest - MEDCouplingExamplesTest - MEDCouplingRemapperTest - # if numpy is used - MEDCouplingNumPyTest - MEDCouplingPickleTest -) +INCLUDE(tests.set) -FOREACH(tfile ${TEST_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(${TEST_NAME} python ${tfile}.py) +FOREACH(tfile ${ALL_TESTS}) + GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE) + SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME}) + ADD_TEST(${TEST_NAME} python ${tfile}) SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} diff --git a/src/MEDCoupling_Swig/tests.set b/src/MEDCoupling_Swig/tests.set new file mode 100644 index 000000000..4382ef42e --- /dev/null +++ b/src/MEDCoupling_Swig/tests.set @@ -0,0 +1,38 @@ +# Copyright (C) 2017 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 +# + +SET(BASE_TESTS + MEDCouplingBasicsTest1.py + MEDCouplingBasicsTest2.py + MEDCouplingBasicsTest3.py + MEDCouplingBasicsTest4.py + MEDCouplingBasicsTest5.py + MEDCouplingBasicsTest6.py + MEDCouplingIntersectTest.py + MEDCouplingExamplesTest.py + MEDCouplingRemapperTest.py +) + +# if numpy is used +SET(NUMPY_TESTS + MEDCouplingNumPyTest.py + MEDCouplingPickleTest.py +) + +SET(ALL_TESTS ${BASE_TESTS} ${NUMPY_TESTS}) diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index f2d45aef9..0e7f429f7 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2016 CEA/DEN, EDF R&D +# Copyright (C) 2012-2017 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 @@ -80,7 +80,8 @@ SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/MEDLoader.py ${MEDCOUPLING_IN INSTALL(FILES MEDLoaderSplitter.py DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) -INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest1.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest123.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py medutilities.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS}) + +INSTALL(FILES ${ALL_TESTS} MEDLoaderDataForTest.py MEDLoaderTest1.py MEDLoaderTest2.py MEDLoaderTest3.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py medutilities.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS}) INSTALL(FILES med2sauv PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDCOUPLING_INSTALL_BINS} ) INSTALL(FILES sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDCOUPLING_INSTALL_BINS} ) @@ -90,23 +91,23 @@ INSTALL(FILES ConvertMEDFileTo30.py PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_ SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -ADD_TEST(MEDLoaderTest1_2_3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest123.py) -SET_TESTS_PROPERTIES(MEDLoaderTest1_2_3 PROPERTIES ENVIRONMENT "${tests_env}") - -ADD_TEST(MEDLoaderTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest4.py) -SET_TESTS_PROPERTIES(MEDLoaderTest4 PROPERTIES ENVIRONMENT "${tests_env}") - -ADD_TEST(MEDLoaderExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderExamplesTest.py) -SET_TESTS_PROPERTIES(MEDLoaderExamplesTest PROPERTIES ENVIRONMENT "${tests_env}") -ADD_TEST(SauvLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SauvLoaderTest.py) -SET_TESTS_PROPERTIES(SauvLoaderTest PROPERTIES ENVIRONMENT "${tests_env}") +FOREACH(test ${BASE_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") +ENDFOREACH() IF(NUMPY_FOUND) # Add Remapper to the Python path: SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}/../../MEDCoupling_Swig") SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_TEST(MEDLoaderCouplingTrainingSession ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderCouplingTrainingSession.py) - SET_TESTS_PROPERTIES(MEDLoaderCouplingTrainingSession PROPERTIES ENVIRONMENT "${tests_env}") + FOREACH(test ${NUMPY_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() ENDIF(NUMPY_FOUND) # Application tests @@ -114,15 +115,11 @@ ENDIF(NUMPY_FOUND) SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/MEDLoader_Swig) SET(MEDLOADER_TEST_FILES + ${ALL_TESTS} MEDLoaderDataForTest.py - MEDLoaderTest123.py MEDLoaderTest1.py MEDLoaderTest2.py MEDLoaderTest3.py - MEDLoaderTest4.py - SauvLoaderTest.py - MEDLoaderExamplesTest.py - MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py diff --git a/src/MEDLoader/Swig/CTestTestfileInstall.cmake b/src/MEDLoader/Swig/CTestTestfileInstall.cmake index 9e3da7572..d336cd942 100644 --- a/src/MEDLoader/Swig/CTestTestfileInstall.cmake +++ b/src/MEDLoader/Swig/CTestTestfileInstall.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D +# Copyright (C) 2015-2017 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 @@ -17,18 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(TEST_NAMES - MEDLoaderTest123 - MEDLoaderTest4 - MEDLoaderExamplesTest - SauvLoaderTest - # if numpy is used - MEDLoaderCouplingTrainingSession -) +INCLUDE(tests.set) -FOREACH(tfile ${TEST_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(${TEST_NAME} python ${tfile}.py) +FOREACH(tfile ${ALL_TESTS}) + GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE) + SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME}) + ADD_TEST(${TEST_NAME} python ${tfile}) SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" TIMEOUT ${TIMEOUT} diff --git a/src/MEDLoader/Swig/tests.set b/src/MEDLoader/Swig/tests.set new file mode 100644 index 000000000..7ff9acac6 --- /dev/null +++ b/src/MEDLoader/Swig/tests.set @@ -0,0 +1,32 @@ +# Copyright (C) 2017 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 +# + +SET(BASE_TESTS + MEDLoaderTest123.py + MEDLoaderTest4.py + MEDLoaderExamplesTest.py + SauvLoaderTest.py +) + +# if numpy is used +SET(NUMPY_TESTS + MEDLoaderCouplingTrainingSession.py +) + +SET(ALL_TESTS ${BASE_TESTS} ${NUMPY_TESTS})