From a257833128f8cf5d7d102f2948be36dbff512326 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 25 May 2020 19:58:35 +0300 Subject: [PATCH] Rearrange tests --- CMakeLists.txt | 19 +++---- ...nstall.cmake => CTestTestfileInstall.cmake | 12 +++-- doc/salome/CMakeLists.txt | 4 +- doc/salome/examples/CMakeLists.txt | 42 +++++++-------- doc/salome/examples/examples.set | 4 +- doc/salome/gui/GMSHPLUGIN/CMakeLists.txt | 4 +- tests/CMakeLists.txt | 52 +++++++++---------- tests/tests.set | 4 +- 8 files changed, 69 insertions(+), 72 deletions(-) rename tests/CTestTestfileInstall.cmake => CTestTestfileInstall.cmake (81%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff16b06..04868ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,12 +142,6 @@ IF(EXISTS ${SMESH_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH with GUI, please set SALOME_BUILD_GUI=ON in SMESH module") ENDIF(NOT SALOME_SMESH_BUILD_GUI) ENDIF(SALOME_BUILD_GUI) - IF(SALOME_BUILD_DOC) - IF(NOT SALOME_SMESH_BUILD_DOC) - MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH documentation to build GMSHPLUGIN documentation. " - "So, you should either set SALOME_BUILD_DOC=OFF in GMSHPLUGIN or set SALOME_BUILD_DOC=ON in SMESH module.") - ENDIF(NOT SALOME_SMESH_BUILD_DOC) - ENDIF(SALOME_BUILD_DOC) ELSE(EXISTS ${SMESH_ROOT_DIR}) MESSAGE(FATAL_ERROR "We absolutely need a Salome SMESH, please define SMESH_ROOT_DIR") ENDIF(EXISTS ${SMESH_ROOT_DIR}) @@ -213,9 +207,7 @@ ADD_SUBDIRECTORY(bin) IF(SALOME_BUILD_TESTS) ADD_SUBDIRECTORY(tests) ENDIF(SALOME_BUILD_TESTS) -IF(SALOME_BUILD_DOC) - ADD_SUBDIRECTORY(doc) -ENDIF(SALOME_BUILD_DOC) +ADD_SUBDIRECTORY(doc) # Header configuration # ==================== @@ -274,3 +266,12 @@ INSTALL(FILES # Install the export set for use with the install-tree INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" FILE ${PROJECT_NAME}Targets.cmake) + +IF(SALOME_BUILD_TESTS) + CONFIGURE_FILE(CTestTestfileInstall.cmake + ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake + @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfileInstall.cmake + DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS} + RENAME CTestTestfile.cmake) +ENDIF() diff --git a/tests/CTestTestfileInstall.cmake b/CTestTestfileInstall.cmake similarity index 81% rename from tests/CTestTestfileInstall.cmake rename to CTestTestfileInstall.cmake index adbf212..ae83423 100644 --- a/tests/CTestTestfileInstall.cmake +++ b/CTestTestfileInstall.cmake @@ -19,16 +19,18 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +SET(TESTS_DIR "$ENV{GMSHPLUGIN_ROOT_DIR}/@SALOME_INSTALL_DOC@/examples/GMSHPLUGIN") + INCLUDE(tests.set) INCLUDE(examples.set) SET(COMPONENT_NAME GMSHPLUGIN) SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) - +SET(TIMEOUT 300) -FOREACH(tfile ${TEST_NAMES} ${EXAMPLE_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py) +FOREACH(tfile ${TEST_SCRIPTS} ${EXAMPLE_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + SET(TEST_NAME "${COMPONENT_NAME}_${TEST_NAME}") + ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${TESTS_DIR}/${tfile}) SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") ENDFOREACH() diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt index fc08592..76372b3 100644 --- a/doc/salome/CMakeLists.txt +++ b/doc/salome/CMakeLists.txt @@ -20,4 +20,6 @@ # ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(gui) \ No newline at end of file +IF(SALOME_BUILD_DOC) + ADD_SUBDIRECTORY(gui) +ENDIF() diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index 5d50b97..361e88a 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -19,33 +19,29 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py") -#INSTALL(FILES ${files} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) - INCLUDE(examples.set) -SET(COMPONENT_NAME GMSHPLUGIN) -SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) +# Install examples + +INSTALL(FILES ${EXAMPLE_SCRIPTS} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) + +# Tests -SET(TEST_INSTALL_DIRECTORY ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +IF(SALOME_BUILD_TESTS) + # make test -# make test -SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + SET(SALOME_TEST_DRIVER "${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") + SET(TIMEOUT 300) + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -FOREACH(tfile ${EXAMPLE_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py) - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") - INSTALL(FILES ${tfile}.py DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) -ENDFOREACH() + FOREACH(tfile ${EXAMPLE_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + ADD_TEST(NAME ${TEST_NAME} + COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() -# salome test -FOREACH(tfile ${EXAMPLE_NAMES}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py - DESTINATION ${TEST_INSTALL_DIRECTORY}) -ENDFOREACH() + # salome test -INSTALL(FILES examples.set DESTINATION ${TEST_INSTALL_DIRECTORY}) \ No newline at end of file + INSTALL(FILES examples.set DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +ENDIF() diff --git a/doc/salome/examples/examples.set b/doc/salome/examples/examples.set index be7acf9..8d34b4b 100644 --- a/doc/salome/examples/examples.set +++ b/doc/salome/examples/examples.set @@ -19,6 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(EXAMPLE_NAMES - gmshdemo +SET(EXAMPLE_SCRIPTS + gmshdemo.py ) diff --git a/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt b/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt index 7c20c53..f3bbd49 100644 --- a/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt +++ b/doc/salome/gui/GMSHPLUGIN/CMakeLists.txt @@ -24,8 +24,8 @@ SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py) SALOME_CONFIGURE_FILE(static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html) SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header_py.html) -SET(smesh_file "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py") -SET(kernel_file "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") +SET(smesh_file "${SMESH_ROOT_DIR}/bin/salome/collect_mesh_methods.py") +SET(kernel_file "${KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py") SET(ADD_VAR) LIST(APPEND ADD_VAR SMESH_MeshersList=GMSHPlugin) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 286daed..25d2186 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,31 +21,27 @@ INCLUDE(tests.set) -SET(COMPONENT_NAME GMSHPLUGIN) -SET(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") -SET(TIMEOUT 300) - -SET(TEST_INSTALL_DIRECTORY ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) - -# make test -SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - -FOREACH(tfile ${TEST_NAMES}) - SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) - ADD_TEST(NAME ${TEST_NAME} - COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py) - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") - SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") -ENDFOREACH() - -# salome test -FOREACH(tfile ${TEST_NAMES}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py - DESTINATION ${TEST_INSTALL_DIRECTORY}) -ENDFOREACH() - -INSTALL(FILES CTestTestfileInstall.cmake - DESTINATION ${TEST_INSTALL_DIRECTORY} - RENAME CTestTestfile.cmake) - -INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) \ No newline at end of file +# Install tests + +INSTALL(FILES ${TEST_SCRIPTS} DESTINATION ${SALOME_INSTALL_DOC}/examples/GMSHPLUGIN) + +# Tests + +IF(SALOME_BUILD_TESTS) + # make test + + SET(SALOME_TEST_DRIVER "${KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py") + SET(TIMEOUT 300) + SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + + FOREACH(tfile ${TEST_SCRIPTS}) + GET_FILENAME_COMPONENT(TEST_NAME ${tfile} NAME_WE) + ADD_TEST(NAME ${TEST_NAME} + COMMAND ${PYTHON_EXECUTABLE} -B ${SALOME_TEST_DRIVER} ${TIMEOUT} ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env}") + ENDFOREACH() + + # salome test + + INSTALL(FILES tests.set DESTINATION ${SALOME_GMSHPLUGIN_INSTALL_TESTS}) +ENDIF() diff --git a/tests/tests.set b/tests/tests.set index f089c71..5f4d23c 100644 --- a/tests/tests.set +++ b/tests/tests.set @@ -19,6 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SET(TEST_NAMES - basicGroup +SET(TEST_SCRIPTS + basicGroup.py ) -- 2.39.2