CMakeLists.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # vim: syntax=cmake
  2. # ----------------------------------------------------------------------------
  3. # mpp built-in unit test case
  4. # ----------------------------------------------------------------------------
  5. # macro for adding mpp sub-module unit test
  6. macro(add_mpp_test module ext)
  7. set(test_name ${module}_test)
  8. set(file_name ${test_name}.${ext})
  9. string(TOUPPER ${test_name} test_tag)
  10. #message(STATUS "moduule : ${module}")
  11. #message(STATUS "test_name : ${test_name}")
  12. #message(STATUS "test_tag : ${test_tag}")
  13. option(${test_tag} "Build mpp ${module}.${ext} unit test" ${BUILD_TEST})
  14. if(${test_tag})
  15. add_executable(${test_name} ${file_name} mpp_event_trigger.c mpp_parse_cfg.c)
  16. target_link_libraries(${test_name} ${MPP_SHARED} utils)
  17. set_target_properties(${test_name} PROPERTIES FOLDER "test")
  18. install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  19. #add_test(NAME ${test_name} COMMAND ${test_name})
  20. endif()
  21. endmacro()
  22. # mpp info test
  23. add_mpp_test(mpp_info c)
  24. # mpi decoder unit test
  25. add_mpp_test(mpi_dec c)
  26. # mpi decoder multi-thread input / output unit test
  27. add_mpp_test(mpi_dec_mt c)
  28. # mpi decoder no-thread input / output unit test
  29. add_mpp_test(mpi_dec_nt c)
  30. # mpi encoder unit test
  31. add_mpp_test(mpi_enc c)
  32. # mpi encoder multi-thread input / output unit test
  33. add_mpp_test(mpi_enc_mt cpp)
  34. # new mpi rc unit test
  35. add_mpp_test(mpi_rc2 c)
  36. # new dec multi unit test
  37. add_mpp_test(mpi_dec_multi c)
  38. macro(add_legacy_test module)
  39. set(test_name ${module}_test)
  40. string(TOUPPER ${test_name} test_tag)
  41. #message(STATUS "moduule : ${module}")
  42. #message(STATUS "test_name : ${test_name}")
  43. #message(STATUS "test_tag : ${test_tag}")
  44. option(${test_tag} "Build legacy ${module} unit test" ${BUILD_TEST})
  45. if(${test_tag})
  46. add_executable(${test_name} ${test_name}.c)
  47. if(ASAN_CHECK)
  48. target_link_libraries(${test_name} ${ASAN_LIB} pthread dl)
  49. else(ASAN_CHECK)
  50. target_link_libraries(${test_name} dl)
  51. endif(ASAN_CHECK)
  52. set_target_properties(${test_name} PROPERTIES FOLDER "test")
  53. install(TARGETS ${test_name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  54. endif()
  55. endmacro()
  56. # legacy vpu_api unit test
  57. add_legacy_test(vpu_api)