XAO test fixed to work in salome test

This commit is contained in:
Gilles DAVID 2017-09-22 15:46:58 +02:00
parent b59b99da3e
commit 7a3c2d25cc
4 changed files with 48 additions and 7 deletions

View File

@ -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

View File

@ -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")

View File

@ -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;
}

View File

@ -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})