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.

55 lines
1.6 KiB

  1. cmake_minimum_required (VERSION 2.8.12)
  2. enable_testing()
  3. project(failure_reports)
  4. # gather tests about proper failure reports
  5. set(MATLAB_FIND_DEBUG TRUE)
  6. if(IS_MCR)
  7. set(RUN_UNIT_TESTS FALSE)
  8. else()
  9. set(RUN_UNIT_TESTS TRUE)
  10. set(components MAIN_PROGRAM)
  11. endif()
  12. if(NOT "${MCR_ROOT}" STREQUAL "")
  13. set(Matlab_ROOT_DIR "${MCR_ROOT}")
  14. if(NOT EXISTS "${MCR_ROOT}")
  15. message(FATAL_ERROR "MCR does not exist ${MCR_ROOT}")
  16. endif()
  17. endif()
  18. find_package(Matlab REQUIRED COMPONENTS ${components})
  19. # main extensions for testing, same as other tests
  20. matlab_add_mex(
  21. # target name
  22. NAME cmake_matlab_test_wrapper1
  23. # output name
  24. OUTPUT_NAME cmake_matlab_mex1
  25. SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp
  26. DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt
  27. )
  28. if(RUN_UNIT_TESTS)
  29. # the unit test file does not exist: the failure should be properly reported
  30. matlab_add_unit_test(
  31. NAME ${PROJECT_NAME}_matlabtest-1
  32. TIMEOUT 300
  33. UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile.m
  34. ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
  35. )
  36. set_tests_properties(${PROJECT_NAME}_matlabtest-1 PROPERTIES WILL_FAIL TRUE)
  37. # without the unit test framework
  38. matlab_add_unit_test(
  39. NAME ${PROJECT_NAME}_matlabtest-2
  40. TIMEOUT 300
  41. NO_UNITTEST_FRAMEWORK
  42. UNITTEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../nonexistantfile2.m
  43. ADDITIONAL_PATH $<TARGET_FILE_DIR:cmake_matlab_test_wrapper1>
  44. )
  45. set_tests_properties(${PROJECT_NAME}_matlabtest-2 PROPERTIES WILL_FAIL TRUE)
  46. endif()