From 091be8531552c480f5aaab1797476185584910fc Mon Sep 17 00:00:00 2001 From: Gabriel Hege Date: Tue, 15 Oct 2024 14:50:16 +0200 Subject: [PATCH] ensure the test binaries are built, when running the test suite even when building with VVENC_LIBRARY_ONLY=1. Also, only build vvencinterfacetest and vvenclibtest on demand. --- cmake/modules/vvencTests.cmake | 10 +++++++++- test/vvencinterfacetest/CMakeLists.txt | 5 +---- test/vvenclibtest/CMakeLists.txt | 5 +---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmake/modules/vvencTests.cmake b/cmake/modules/vvencTests.cmake index 762df3310..11c8cac61 100644 --- a/cmake/modules/vvencTests.cmake +++ b/cmake/modules/vvencTests.cmake @@ -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 ) @@ -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() @@ -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 "$" --target vvencinterfacetest --target vvenclibtest --target vvencapp --target vvencFFapp ) +set_tests_properties( Build_test_binaries PROPERTIES FIXTURES_SETUP BuildTestBinaries TIMEOUT 0 ) diff --git a/test/vvencinterfacetest/CMakeLists.txt b/test/vvencinterfacetest/CMakeLists.txt index eb82d09f6..1603c1bc9 100644 --- a/test/vvencinterfacetest/CMakeLists.txt +++ b/test/vvencinterfacetest/CMakeLists.txt @@ -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 $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option> diff --git a/test/vvenclibtest/CMakeLists.txt b/test/vvenclibtest/CMakeLists.txt index 08fbc50d2..c07503b62 100644 --- a/test/vvenclibtest/CMakeLists.txt +++ b/test/vvenclibtest/CMakeLists.txt @@ -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 $<$,$>:-Wall> $<$:-Wall -fdiagnostics-show-option>