Salome HOME
XAO test fixed to work in salome test gdd/fix_xao_test
authorGilles DAVID <gilles-g.david@edf.fr>
Fri, 22 Sep 2017 13:46:58 +0000 (15:46 +0200)
committerGilles DAVID <gilles-g.david@edf.fr>
Fri, 22 Sep 2017 13:46:58 +0000 (15:46 +0200)
src/XAO/tests/CMakeLists.txt
src/XAO/tests/CTestTestfileInstall.cmake
src/XAO/tests/TestUtils.hxx
src/XAO/tests/data/CMakeLists.txt [new file with mode: 0644]

index 30ee76775f51849df9ecc42d44e8d135fb036c0f..15c9a5f3b2e458bca30a0d8bb94023dad270c44d 100644 (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
index 1014dbc9563d1fb1e39fceb5326c8b62caf6419f..443de45804856c72b062b70e9dd5aab2de97af91 100644 (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")
index 593916c2279b34fa3ad76e4b8618a034765ee5ba..a1cd41318abe9a971cd665d51d98abc104e43148 100644 (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;
         }
 
diff --git a/src/XAO/tests/data/CMakeLists.txt b/src/XAO/tests/data/CMakeLists.txt
new file mode 100644 (file)
index 0000000..335e6d8
--- /dev/null
@@ -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})