From: Gilles DAVID Date: Fri, 22 Sep 2017 13:46:58 +0000 (+0200) Subject: XAO test fixed to work in salome test X-Git-Tag: V8_4_0b1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fgdd%2Ffix_xao_test;p=modules%2Fgeom.git XAO test fixed to work in salome test --- diff --git a/src/XAO/tests/CMakeLists.txt b/src/XAO/tests/CMakeLists.txt index 30ee76775..15c9a5f3b 100644 --- a/src/XAO/tests/CMakeLists.txt +++ b/src/XAO/tests/CMakeLists.txt @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# --- options --- +ADD_SUBDIRECTORY(data) # additional include directories INCLUDE_DIRECTORIES( @@ -57,15 +57,15 @@ ADD_EXECUTABLE(TestXAO ${TestXAO_SOURCES}) TARGET_LINK_LIBRARIES(TestXAO ${_link_LIBRARIES}) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) +SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao) ADD_TEST(TestXAO TestXAO) -SET_TESTS_PROPERTIES(TestXAO PROPERTIES ENVIRONMENT "GEOM_SRC_DIR=${PROJECT_SOURCE_DIR};${tests_env}") +SET_TESTS_PROPERTIES(TestXAO PROPERTIES ENVIRONMENT "XAO_DATA_DIR=${TEST_INSTALL_DIRECTORY}/data;${tests_env}") INSTALL(TARGETS TestXAO DESTINATION ${SALOME_INSTALL_BINS}) # Application tests -SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao) INSTALL(TARGETS TestXAO RUNTIME DESTINATION ${TEST_INSTALL_DIRECTORY}) INSTALL(FILES CTestTestfileInstall.cmake diff --git a/src/XAO/tests/CTestTestfileInstall.cmake b/src/XAO/tests/CTestTestfileInstall.cmake index 1014dbc95..443de4580 100644 --- a/src/XAO/tests/CTestTestfileInstall.cmake +++ b/src/XAO/tests/CTestTestfileInstall.cmake @@ -18,4 +18,6 @@ # ADD_TEST(GEOM_TestXAO python ${SALOME_TEST_DRIVER} ${TIMEOUT} TestXAO) -SET_TESTS_PROPERTIES(GEOM_TestXAO PROPERTIES LABELS "${COMPONENT_NAME}") +SET_TESTS_PROPERTIES(GEOM_TestXAO PROPERTIES + LABELS "${COMPONENT_NAME}" + ENVIRONMENT "XAO_DATA_DIR=$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/test/GEOM/xao/data") diff --git a/src/XAO/tests/TestUtils.hxx b/src/XAO/tests/TestUtils.hxx index 593916c22..a1cd41318 100644 --- a/src/XAO/tests/TestUtils.hxx +++ b/src/XAO/tests/TestUtils.hxx @@ -30,9 +30,19 @@ namespace XAO public: static std::string getTestFilePath(const std::string& fileName) { - std::string dataDir = getenv("GEOM_SRC_DIR"); - dataDir += "/src/XAO/tests/data/"; - dataDir += fileName; + std::string dataDir = ""; + char* geomSrcDir = getenv("XAO_DATA_DIR"); + if (geomSrcDir != NULL) + { + dataDir = geomSrcDir; +#if defined _WIN32 || defined __CYGWIN__ + dataDir += "\\"; +#else + dataDir += "/"; +#endif + dataDir += fileName; + } + return dataDir; } diff --git a/src/XAO/tests/data/CMakeLists.txt b/src/XAO/tests/data/CMakeLists.txt new file mode 100644 index 000000000..335e6d86a --- /dev/null +++ b/src/XAO/tests/data/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (C) 2012-2017 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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(XAO_DATA_FILES + Box_1.brep + Box_2.brep + Cut_2.brep + test.xao + ) + +# --- rules --- +SET(XAO_DATA_DIR ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/xao/data) +INSTALL(FILES ${XAO_DATA_FILES} DESTINATION ${XAO_DATA_DIR})