Skip to content

Commit

Permalink
ensure the test binaries are built, when running the test suite
Browse files Browse the repository at this point in the history
even when building with VVENC_LIBRARY_ONLY=1.

Also, only build vvencinterfacetest and vvenclibtest on demand.
  • Loading branch information
K-os committed Oct 15, 2024
1 parent 7229972 commit 091be85
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 9 additions & 1 deletion cmake/modules/vvencTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ add_test( NAME Test_vvenclibtest-sdk_default COMMAND vvenclibtest 4
add_test( NAME Test_vvenclibtest-sdk_stringapi_interface COMMAND vvenclibtest 5 )
add_test( NAME Test_vvenclibtest-timestamps COMMAND vvenclibtest 6 )

# add BuildTestBinaries dependency to all defined tests
get_directory_property( ALL_TESTS TESTS )
set_tests_properties( ${ALL_TESTS} PROPERTIES FIXTURES_REQUIRED BuildTestBinaries )

set( CLEANUP_TEST_FILES "" )

function( add_vvenc_test NAME TIMEOUT OUT_OUTPUT REQUIRES )
Expand All @@ -32,7 +36,7 @@ function( add_vvenc_test NAME TIMEOUT OUT_OUTPUT REQUIRES )
add_test( NAME Test_${NAME} COMMAND ${command} )
set_tests_properties( Test_${NAME} PROPERTIES
TIMEOUT ${TIMEOUT}
FIXTURES_REQUIRED "${REQUIRES};cleanup"
FIXTURES_REQUIRED "${REQUIRES};BuildTestBinaries;cleanup"
FIXTURES_SETUP "${out_file}" # this test is the setup for the output-file
)
endfunction()
Expand Down Expand Up @@ -80,3 +84,7 @@ add_vvenc_test( compare_output-medium_rc2p_statsFile_easy 30 NO_OUTPUT "${OUT_VV

add_test( NAME Cleanup_remove_temp_files COMMAND ${CMAKE_COMMAND} -E remove -f ${CLEANUP_TEST_FILES} rec.yuv stats_exp.json stats_easy.json )
set_tests_properties( Cleanup_remove_temp_files PROPERTIES FIXTURES_CLEANUP cleanup )

# ensure vvencinterfacetest & vvenclibtest are built
add_test( NAME Build_test_binaries COMMAND ${CMAKE_COMMAND} --build "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --target vvencinterfacetest --target vvenclibtest --target vvencapp --target vvencFFapp )
set_tests_properties( Build_test_binaries PROPERTIES FIXTURES_SETUP BuildTestBinaries TIMEOUT 0 )
5 changes: 1 addition & 4 deletions test/vvencinterfacetest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ if( MSVC )
endif()

# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${RESOURCE_FILE} )
add_executable( ${EXE_NAME} EXCLUDE_FROM_ALL ${SRC_FILES} ${INC_FILES} ${RESOURCE_FILE} )
set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" )
if( VVENC_LIBRARY_ONLY )
set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE )
endif()

target_compile_options( ${EXE_NAME} PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down
5 changes: 1 addition & 4 deletions test/vvenclibtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ if( MSVC )
endif()

# add executable
add_executable( ${EXE_NAME} ${SRC_FILES} ${INC_FILES} ${RESOURCE_FILE} )
add_executable( ${EXE_NAME} EXCLUDE_FROM_ALL ${SRC_FILES} ${INC_FILES} ${RESOURCE_FILE} )
set_target_properties( ${EXE_NAME} PROPERTIES RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}" )
set_target_properties( ${EXE_NAME} PROPERTIES MINSIZEREL_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}" )
if( VVENC_LIBRARY_ONLY )
set_target_properties( ${EXE_NAME} PROPERTIES EXCLUDE_FROM_ALL TRUE )
endif()

target_compile_options( ${EXE_NAME} PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall>
$<$<CXX_COMPILER_ID:GNU>:-Wall -fdiagnostics-show-option>
Expand Down

0 comments on commit 091be85

Please sign in to comment.