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