]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Rework HDF testing procedure
authorArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Fri, 23 Oct 2020 19:15:00 +0000 (22:15 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Sat, 28 Nov 2020 12:16:25 +0000 (15:16 +0300)
CMakeLists.txt
src/CTestTestfileInstall.cmake [new file with mode: 0644]
src/ConnectorAPI/Test/CMakeLists.txt
test.hdfs/CMakeLists.txt
test.hdfs/CTestTestfileInstall.cmake [new file with mode: 0644]
test.hdfs/__main__.py [new file with mode: 0644]
test.hdfs/test.py [deleted file]
test.hdfs/testme.py [new file with mode: 0644]
test.hdfs/tests.set [new file with mode: 0644]

index 8baa2bfec86af201e3b364d520e2f335eb38d5fd..2d8fef60ec80470adc09fe7f626e3e74aadf22a2 100644 (file)
@@ -61,6 +61,11 @@ IF(${HAVE_SALOME})
   ELSE(EXISTS ${KERNEL_ROOT_DIR})
     MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
   ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+  SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
+  IF(EXISTS ${GUI_ROOT_DIR})
+    LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/salome_adm/cmake_files")
+    FIND_PACKAGE(SalomeGUI REQUIRED)
+  ENDIF(EXISTS ${GUI_ROOT_DIR})
   INCLUDE(SalomeSetupPlatform)   # From CONFIGURATION
 
   FIND_PACKAGE(SalomePythonInterp REQUIRED)
@@ -125,24 +130,18 @@ ENDIF(${HAVE_SALOME})
 #  Test environment
 # ===================
 
-IF(WIN32)
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}")
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${SUIT_LIB_DIR}")
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK "${SALOME_KERNEL_LIBDIR}")
-ELSE(WIN32)
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}")
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SUIT_LIB_DIR}")
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SALOME_KERNEL_LIBDIR}")
-ENDIF(WIN32)
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}")
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SUIT_LIB_DIR}")
+SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK "${SALOME_KERNEL_LIBDIR}")
 
 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}")
 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}")
 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}")
 
+SET(SALOME_SHAPER_INSTALL_TESTS "${SHAPER_INSTALL_PYTHON_FILES}/test" CACHE PATH "Path to tests directory")
+
 # Sketcher: Change radius of circular edges while dragging a point on the edge
 SET(SKETCHER_CHANGE_RADIUS_WHEN_MOVE TRUE)
 
@@ -218,9 +217,16 @@ IF(ADD_COMPATIBILITY_TESTS)
   ADD_CUSTOM_TARGET(run_compatibility_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -LE "tests_compatibility")
 ENDIF(ADD_COMPATIBILITY_TESTS)
 
-IF(ADD_HDF_TESTS)
-  ADD_SUBDIRECTORY (test.hdfs)
-ENDIF(ADD_HDF_TESTS)
+IF(${HAVE_SALOME})
+  IF(ADD_HDF_TESTS)
+    ADD_SUBDIRECTORY (test.hdfs)
+  ENDIF(ADD_HDF_TESTS)
+
+  INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/CTestTestfileInstall.cmake
+          DESTINATION ${SALOME_SHAPER_INSTALL_TESTS}
+          RENAME CTestTestfile.cmake)
+ENDIF(${HAVE_SALOME})
+
 
 IF(SHAPER_BUILD_DOC)
     INCLUDE(FindSphinx)
diff --git a/src/CTestTestfileInstall.cmake b/src/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..c4e4606
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) 2020  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(SALOME_TEST_DRIVER "$ENV{KERNEL_ROOT_DIR}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME SHAPER)
+
+# Add all test subdirs
+SUBDIRS(ConnectorAPI
+        HDFs
+)
index cc288b03a30dfbe9d41c1dfdd1c26254ce10d5dc..7e0b4846d20790be453ef33eb0bb6af0f937b8e0 100644 (file)
@@ -21,19 +21,8 @@ INCLUDE(tests.set)
 
 SET(COMPONENT_NAME SHAPER)
 
-SET(SALOME_SHAPER_INSTALL_TESTS "${SHAPER_INSTALL_PYTHON_FILES}/test")
-SET(TEST_INSTALL_DIRECTORY ${SALOME_SHAPER_INSTALL_TESTS})
-
-# make test
-SET(SALOME_INSTALL_LIBS "lib/salome")
-# Adding KERNEL and GUI libraries to environment so that Salome launches correctly
-if (WIN32)
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK ${KERNEL_ROOT_DIR}/${SALOME_INSTALL_LIBS})
-  SALOME_ACCUMULATE_ENVIRONMENT(PATH NOCHECK ${GUI_ROOT_DIR}/${SALOME_INSTALL_LIBS})
-else()
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${KERNEL_ROOT_DIR}/${SALOME_INSTALL_LIBS})
-  SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${GUI_ROOT_DIR}/${SALOME_INSTALL_LIBS})
-endif()
+SET(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/ConnectorAPI")
+
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 
 
index 1ec95225348e6cc4112922acd3f053326e84ae92..eeb8fe24037ab6cc170138fa0693ab27c95ca382 100644 (file)
 
 ENABLE_TESTING()
 
-SET(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
+INCLUDE(tests.set)
 
-set(hdfFilesRestr "")
-if (EXISTS ${RESTRICTED_ROOT_DIR})
-  file(GLOB hdfFilesRestr "${RESTRICTED_ROOT_DIR}/SHAPER/test.hdfs/*.hdf")
-endif()
+SET(COMPONENT_NAME SHAPER)
+SET(TIMEOUT 600)
 
-file(GLOB hdfFilesCur "${CMAKE_CURRENT_SOURCE_DIR}/*.hdf")
-set(hdfFilesRestr ${hdfFilesCur} ${hdfFilesRestr})
+SET(TEST_INSTALL_DIRECTORY "${SALOME_SHAPER_INSTALL_TESTS}/HDFs")
 
-if (WIN32) # different separators and path to libraries variable name
-  SET(_JUSTPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${SUIT_LIB_DIR};$ENV{PATH}")
-  STRING(REPLACE "\\" "/" _JUSTPATH "${_JUSTPATH}")
-  STRING(REPLACE ";" "\\;" _JUSTPATH "${_JUSTPATH}")
-  SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES};${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS};$ENV{PYTHONPATH}")
-  STRING(REPLACE "\\" "/" _PYTHONPATH "${_PYTHONPATH}")
-  STRING(REPLACE ";" "\\;" _PYTHONPATH "${_PYTHONPATH}")
-else()
-  SET(_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_BIN}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${SUIT_LIB_DIR}:$ENV{LD_LIBRARY_PATH}")
-  SET(_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_SWIG}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_PLUGIN_FILES}:${CMAKE_INSTALL_PREFIX}/${SHAPER_INSTALL_ADDONS}:$ENV{PYTHONPATH}")
-endif()
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 
-foreach(eachFilePath ${hdfFilesRestr})
-  # Strip the ".hdf" suffix
-  GET_FILENAME_COMPONENT(aTestName ${eachFilePath} NAME_WE)
-  # Check corresponding ".py" file with reference data exists
-  IF(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${aTestName}.py")
-    MESSAGE(WARNING "File ${aTestName}.py containing reference data does not exist")
-    continue()
-  ENDIF()
+FOREACH(tfile ${TEST_NAMES})
+  SET(TEST_NAME ${COMPONENT_NAME}_HDF_${tfile})
+  GET_HDF(HDF_TEST_FILE ${tfile})
+  ADD_TEST(NAME ${TEST_NAME}
+           COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/testme.py" "$ENV{KERNEL_ROOT_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${HDF_TEST_FILE}")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ENVIRONMENT "${tests_env};SHAPER_UNIT_TEST_IN_PROGRESS=1")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME};models_hdf")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES TIMEOUT ${TIMEOUT})
+ENDFOREACH()
 
-  # Add "SubprojectName_" prefix
-  GET_FILENAME_COMPONENT(aSubprojectName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-  SET(aTestName "${aSubprojectName}_${aTestName}")
+ADD_CUSTOM_TARGET(run_hdf_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -L "models_hdf")
 
-  # Full path to the python test file being executed
-  SET(aTestFilePath "${eachFilePath}")
-  IF(EXISTS ${aTestFilePath})
-    ADD_TEST(NAME ${aTestName} COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/test.py" "$ENV{KERNEL_ROOT_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${aTestFilePath}")
-    if (WIN32) # different path to libraries variable name
-      SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-        LABELS "models_hdf")
-    else()
-      SET_TESTS_PROPERTIES(${aTestName} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};SHAPER_UNIT_TEST_IN_PROGRESS=1"
-        LABELS "models_hdf")
-    endif()
-    # Debug output...
-    # MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFilePath}")
-  ELSE(EXISTS ${aTestFilePath})
-    MESSAGE(WARNING "Can not find the test file: ${aTestFilePath}")
-  ENDIF(EXISTS ${aTestFilePath})
-endforeach(eachFilePath ${ARGN})
+# salome test
+FOREACH(tfile ${TEST_NAMES})
+  INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py
+          DESTINATION ${TEST_INSTALL_DIRECTORY})
+  IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.hdf")
+    INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.hdf
+            DESTINATION ${TEST_INSTALL_DIRECTORY})
+  ENDIF()
+ENDFOREACH()
 
-ADD_CUSTOM_TARGET(run_hdf_tests COMMAND ${CMAKE_CTEST_COMMAND} -C "${CMAKE_BUILD_TYPE}" -L "models_hdf")
+INSTALL(FILES CTestTestfileInstall.cmake
+  DESTINATION ${TEST_INSTALL_DIRECTORY}
+  RENAME CTestTestfile.cmake)
+
+INSTALL(FILES testme.py DESTINATION ${TEST_INSTALL_DIRECTORY})
+INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY})
diff --git a/test.hdfs/CTestTestfileInstall.cmake b/test.hdfs/CTestTestfileInstall.cmake
new file mode 100644 (file)
index 0000000..ad8cb7d
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (C) 2016-2020  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
+#
+
+INCLUDE(tests.set)
+
+SET(COMPONENT_NAME SHAPER)
+SET(TIMEOUT        600)
+
+FOREACH(tfile ${TEST_NAMES})
+  SET(TEST_NAME ${COMPONENT_NAME}_HDF_${tfile})
+  GET_HDF(HDF_TEST_FILE ${tfile})
+  ADD_TEST(NAME ${TEST_NAME}
+           COMMAND python "${CMAKE_CURRENT_SOURCE_DIR}/testme.py" "$ENV{KERNEL_ROOT_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" "${HDF_TEST_FILE}")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}")
+  SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES TIMEOUT ${TIMEOUT})
+ENDFOREACH()
diff --git a/test.hdfs/__main__.py b/test.hdfs/__main__.py
new file mode 100644 (file)
index 0000000..02a1983
--- /dev/null
@@ -0,0 +1,24 @@
+# Copyright (C) 2016-2020  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
+#
+
+# ============================================================ #
+#                                                              #
+#  Attention: Keep this file for correct execution on Windows  #
+#                                                              #
+# ============================================================ #
diff --git a/test.hdfs/test.py b/test.hdfs/test.py
deleted file mode 100644 (file)
index 669d238..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-if __name__ == '__main__':
-
-  import subprocess
-  from time import sleep
-  import sys, os
-
-  salomeKernelDir = sys.argv[1]
-  sourceDir = sys.argv[2]
-  testfile = sys.argv[3]
-
-  portlogfile = os.getcwd() + "/.salome_port"
-  testlogfile = os.getcwd() + "/test.log"
-  # remove port file if any
-  try:
-    os.remove(portlogfile)
-  except:
-    pass
-
-  isOk = True
-  error = ""
-
-  proc = subprocess.Popen([salomeKernelDir + "/bin/salome/runSalome.py", "--modules", "SHAPER,GEOM", "--gui", "--splash", "0", "--ns-port-log=" + portlogfile, sourceDir + "/test_hdf.py", "args:" + testfile + "," + portlogfile + "," + testlogfile + "," + salomeKernelDir + "," + sourceDir], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-  try:
-    proc.communicate(timeout = 600)
-  except TimeoutExpired:
-    isOk = False
-    proc.kill()
-    out, err = proc.communicate()
-    error = "Killed by CPU limit."
-    print(err)
-
-  with open(testlogfile, 'r') as inputFile:
-    s = inputFile.read()
-    print(s)
-    isOk = isOk and s.find("FAIL") < 0
-  try:
-    os.remove(testlogfile)
-  except:
-    pass
-
-  assert isOk, "Test failed. {}".format(error)
diff --git a/test.hdfs/testme.py b/test.hdfs/testme.py
new file mode 100644 (file)
index 0000000..395c6c0
--- /dev/null
@@ -0,0 +1,62 @@
+# Copyright (C) 2020  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
+#
+
+#!/usr/bin/env python
+
+if __name__ == '__main__':
+
+  import subprocess
+  from time import sleep
+  import sys, os
+
+  salomeKernelDir = sys.argv[1]
+  sourceDir = sys.argv[2]
+  testfile = sys.argv[3]
+
+  portlogfile = os.getcwd() + "/.salome_port"
+  testlogfile = os.getcwd() + "/test.log"
+  # remove port file if any
+  try:
+    os.remove(portlogfile)
+  except:
+    pass
+
+  isOk = True
+  error = ""
+
+  proc = subprocess.Popen([salomeKernelDir + "/bin/salome/runSalome.py", "--modules", "SHAPER,GEOM", "--gui", "--splash", "0", "--ns-port-log=" + portlogfile, sourceDir + "/test_hdf.py", "args:" + testfile + "," + portlogfile + "," + testlogfile + "," + salomeKernelDir + "," + sourceDir], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+  try:
+    proc.communicate(timeout = 600)
+  except TimeoutExpired:
+    isOk = False
+    proc.kill()
+    out, err = proc.communicate()
+    error = "Killed by CPU limit."
+    print(err)
+
+  with open(testlogfile, 'r') as inputFile:
+    s = inputFile.read()
+    print(s)
+    isOk = isOk and s.find("FAIL") < 0
+  try:
+    os.remove(testlogfile)
+  except:
+    pass
+
+  assert isOk, "Test failed. {}".format(error)
diff --git a/test.hdfs/tests.set b/test.hdfs/tests.set
new file mode 100644 (file)
index 0000000..1e7956a
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright (C) 2020  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(RESTRICTED_ROOT_DIR $ENV{RESTRICTED_ROOT_DIR} CACHE PATH "Path to the restricted repository")
+
+# get all restricted HDF tests
+set(hdfFilesRestr "")
+if (EXISTS ${RESTRICTED_ROOT_DIR})
+  file(GLOB hdfFilesRestr "${RESTRICTED_ROOT_DIR}/SHAPER/test.hdfs/*.hdf")
+endif()
+
+# get all HDF tests from the current drectory
+file(GLOB hdfFilesCur "${CMAKE_CURRENT_SOURCE_DIR}/*.hdf")
+set(hdfFilesRestr ${hdfFilesCur} ${hdfFilesRestr})
+
+# collect test names
+set(TEST_NAMES "")
+foreach(eachFilePath ${hdfFilesRestr})
+  # Strip the ".hdf" suffix
+  get_filename_component(aTestName ${eachFilePath} NAME_WE)
+  # Check corresponding ".py" file with reference data exists
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${aTestName}.py")
+    set(TEST_NAMES ${aTestName} ${TEST_NAMES})
+  else()
+    message(WARNING "File ${aTestName}.py containing reference data for ${aTestName}.hdf does not exist")
+  endif()
+endforeach()
+
+# return full path to HDF file related to the given test name
+function(GET_HDF hdfFullPath testName)
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${testName}.hdf")
+    set(${hdfFullPath} "${CMAKE_CURRENT_SOURCE_DIR}/${testName}.hdf" PARENT_SCOPE)
+  elseif(EXISTS "${RESTRICTED_ROOT_DIR}/SHAPER/test.hdfs/${testName}.hdf")
+    set(${hdfFullPath} "${RESTRICTED_ROOT_DIR}/SHAPER/test.hdfs/${testName}.hdf" PARENT_SCOPE)
+  endif()
+endfunction(GET_HDF)
\ No newline at end of file