You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 3.4KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #######################################################################
  2. # Software License Agreement (AGPL-3 License)
  3. #
  4. # OpenViBE SDK Test Software
  5. # Based on OpenViBE V1.1.0, Copyright (C) Inria, 2006-2015
  6. # Copyright (C) Inria, 2015-2017,V1.0
  7. #
  8. # This program is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License version 3,
  10. # as published by the Free Software Foundation.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with this program.
  19. # If not, see <http://www.gnu.org/licenses/>.
  20. #######################################################################
  21. PROJECT(openvibe-file-io-csv-test)
  22. # ------------
  23. # Test naming
  24. # ------------
  25. # As IO test was part of original OpenViBE, prefix is set to vo (validation/open)
  26. SET(TEST_PREFIX vo)
  27. SET(TEST_MODULE FileIO-CSV)
  28. # -------------------------
  29. # List of scenario to test
  30. # -------------------------
  31. # Test scenario for CSV reading and writing test purpose
  32. SET(TEST_SCENARIOS
  33. streamed-matrix
  34. features
  35. signal
  36. stimulation
  37. signal-badtimes
  38. signal-nofiletime
  39. )
  40. # ----------------------
  41. # Configure test target
  42. # ----------------------
  43. # This is just a way to have the test scripts available in the IDE
  44. FILE(GLOB_RECURSE script_files ${CMAKE_CURRENT_SOURCE_DIR}/*.mxs ${CMAKE_CURRENT_SOURCE_DIR}/*.xml ${CMAKE_CURRENT_SOURCE_DIR}/*.xml.in)
  45. ADD_CUSTOM_TARGET(${PROJECT_NAME} SOURCES ${script_files})
  46. SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER ${VALIDATION_FOLDER})
  47. # ---------------------------
  48. # Add test to test to be run
  49. # ---------------------------
  50. FOREACH(SCENARIO ${TEST_SCENARIOS})
  51. # Modify test name to comply to naming rules
  52. SET(TEST_NAME ${TEST_PREFIX}${TEST_MODULE}-${SCENARIO})
  53. #Create scenario file with repository according to the test environement
  54. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${SCENARIO}.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/${SCENARIO}.xml" @ONLY)
  55. SET(SCENARIO_TO_TEST "${CMAKE_CURRENT_BINARY_DIR}/${SCENARIO}.xml")
  56. SET (INPUT_FILE "input-${SCENARIO}.csv")
  57. SET (OUTPUT_FILE "output-${SCENARIO}.csv")
  58. IF ((SCENARIO STREQUAL "signal-badtimes") OR (SCENARIO STREQUAL "signal-nofiletime"))
  59. #specific variable for signal bad time or signal no file time, the outpout file will be compared to another file than the input file
  60. SET(FILE_TO_COMPARE "input-signal.csv")
  61. ELSE ()
  62. # General case, the input and output will be compare
  63. SET(FILE_TO_COMPARE ${INPUT_FILE})
  64. ENDIF()
  65. # The test will compare files. It should be the same
  66. ADD_TEST(NAME ${TEST_NAME}
  67. COMMAND ${CMAKE_COMMAND}
  68. -DUNQUOTE=1
  69. -DCMD1="${CMAKE_COMMAND} -E remove -f ${OVT_OPENVIBE_PLAYER_LOG_FILE}"
  70. # Launch the scenario with all boxes to test
  71. -DCMD2="${OVT_OPENVIBE_PLAYER} --mode=x --play-mode=ff --max-time=2000 --config-file=${OVT_OPENVIBE_DATA}/openvibe.conf --scenario-file=${SCENARIO_TO_TEST}"
  72. # Compare file result with reference file
  73. -DCMD3="${Python3_EXECUTABLE} ${OVT_VALIDATION_TOOLKIT_PATH}/csv-comparator.py ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_TO_COMPARE} ${OVT_TEST_TEMPORARY_DIR}/${OUTPUT_FILE}"
  74. -P ${OVT_CMAKE_DIR}/OvtRunMultipleCommand.cmake
  75. )
  76. SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL ${OVT_OPENVIBE_PLAYER_LOG_FILE})
  77. ENDFOREACH()