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 4.2KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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-regularized-csp)
  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 Regularized-CSP)
  28. # -------------------------
  29. # List of scenario to test
  30. # -------------------------
  31. # Test scenario for regularized-csp
  32. SET(TEST_SCENARIOS
  33. None
  34. Tikhonov
  35. Shrink
  36. Both
  37. )
  38. # Templates xml.in files
  39. SET (TRAIN_REGULARIZED_CSP regularized-csp-train)
  40. SET (REGULARIZED_CSP regularized-csp)
  41. # ----------------------
  42. # Configure test target
  43. # ----------------------
  44. # This is just a way to have the test scripts available in the IDE
  45. FILE(GLOB_RECURSE script_files ${CMAKE_CURRENT_SOURCE_DIR}/*.mxs ${CMAKE_CURRENT_SOURCE_DIR}/*.xml ${CMAKE_CURRENT_SOURCE_DIR}/*.xml.in)
  46. ADD_CUSTOM_TARGET(${PROJECT_NAME} SOURCES ${script_files})
  47. SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER ${VALIDATION_FOLDER})
  48. # ---------------------------
  49. # Add test to test to be run
  50. # ---------------------------
  51. FOREACH(SCENARIO ${TEST_SCENARIOS})
  52. # Create test name complying to naming rules
  53. SET(TEST_NAME ${TEST_PREFIX}${TEST_MODULE}-${SCENARIO})
  54. # The regularized CSP have 4 tests
  55. # Shrinks and Thikhonovs parameters were involved in the train scenario
  56. # A threshold value is set for each test regarding the Shrinks and Thikhonovs parameters
  57. # for each test a training scenario and a test scenario will be created
  58. IF (SCENARIO STREQUAL "Tikhonov")
  59. SET(SHRINKS 0.0)
  60. SET(TIKHONOVS 0.9)
  61. SET(THRESHOLDS 70)
  62. ELSEIF (SCENARIO STREQUAL "Shrink")
  63. SET(SHRINKS 0.9)
  64. SET(TIKHONOVS 0.0)
  65. SET(THRESHOLDS 70)
  66. ELSEIF (SCENARIO STREQUAL "Both")
  67. SET(SHRINKS 0.5)
  68. SET(TIKHONOVS 0.5)
  69. SET(THRESHOLDS 70)
  70. ELSEIF (SCENARIO STREQUAL "None")
  71. SET(SHRINKS 0.0)
  72. SET(TIKHONOVS 0.0)
  73. SET(THRESHOLDS 50)
  74. ENDIF()
  75. # create scenario training scenario file
  76. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${TRAIN_REGULARIZED_CSP}.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/${TRAIN_REGULARIZED_CSP}_${SCENARIO}.xml" @ONLY)
  77. # create scenario test file
  78. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${REGULARIZED_CSP}.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/${REGULARIZED_CSP}_${SCENARIO}.xml" @ONLY)
  79. # assign scenario previously cretaed to variable
  80. SET (SCENARIO_TO_TRAIN "${CMAKE_CURRENT_BINARY_DIR}/${TRAIN_REGULARIZED_CSP}_${SCENARIO}.xml")
  81. SET (SCENARIO_TO_TEST "${CMAKE_CURRENT_BINARY_DIR}/${REGULARIZED_CSP}_${SCENARIO}.xml")
  82. # The test will compare files. It should be the same
  83. ADD_TEST(NAME ${TEST_NAME}
  84. COMMAND ${CMAKE_COMMAND}
  85. -DUNQUOTE=1
  86. -DCMD1="${CMAKE_COMMAND} -E remove -f ${OVT_OPENVIBE_PLAYER_LOG_FILE}"
  87. # Launch the training scenario
  88. -DCMD2="${OVT_OPENVIBE_PLAYER} --mode=x --max-time=2000 --play-mode=ff --config-file=${OVT_OPENVIBE_DATA}/openvibe.conf --scenario-file=${SCENARIO_TO_TRAIN}"
  89. # Launch the scenario to test
  90. -DCMD3="${OVT_OPENVIBE_PLAYER} --mode=x --max-time=15000 --play-mode=ff --config-file=${OVT_OPENVIBE_DATA}/openvibe.conf --scenario-file=${SCENARIO_TO_TEST}"
  91. #Launch python checking module
  92. -DCMD4="${Python3_EXECUTABLE} ${OVT_VALIDATION_TOOLKIT_PATH}/accuracy.py ${OVT_OPENVIBE_PLAYER_LOG_FILE} Cross-validation ${THRESHOLDS}"
  93. -P ${OVT_CMAKE_DIR}/OvtRunMultipleCommand.cmake
  94. )
  95. SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES ATTACHED_FILES_ON_FAIL ${OVT_OPENVIBE_PLAYER_LOG_FILE})
  96. ENDFOREACH()