Skip to content

Commit

Permalink
Remove AVIF_ENABLE_GTEST cmake option. (#2527)
Browse files Browse the repository at this point in the history
There is no need to have two AVIF_ENABLE_GTEST and AVIF_GTEST options.
Now setting AVIF_GTEST=LOCAL or AVIF_GTEST=SYSTEM automatically turns ont gtest tests.
  • Loading branch information
maryla-uc authored Dec 20, 2024
1 parent 4db8f7e commit b808fa0
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-disable-gtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
-DAVIF_CODEC_RAV1E=LOCAL -DAVIF_CODEC_SVT=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=OFF
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=OFF
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
working-directory: ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-fuzztest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL
-DAVIF_LIBYUV=${{ matrix.libyuv }}
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-golden-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_LIBXML2=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GOLDEN_TESTS=ON
-DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON
-DAVIF_GTEST=OFF -DAVIF_ENABLE_WERROR=ON
-DGOLDEN_TESTS_OUTPUT_DIR=${{ runner.temp }}/golden_tests
- name: Build libavif (ninja)
working-directory: ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-linux-static-old-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
-DAVIF_CODEC_LIBGAV1=ON -DAVIF_LOCAL_LIBGAV1=ON
-DAVIF_LOCAL_LIBSHARPYUV=ON -DAVIF_LOCAL_LIBXML2=ON -DAVIF_LOCAL_LIBYUV=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_LOCAL_GTEST=ON
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_WERROR=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBYUV=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-unix-shared-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
-DAVIF_CODEC_AOM_DECODE=OFF -DAVIF_CODEC_AOM_ENCODE=ON
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=SYSTEM
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=SYSTEM
-DAVIF_BUILD_GDK_PIXBUF=ON -DCMAKE_INSTALL_PREFIX=./build/install
-DAVIF_ENABLE_WERROR=ON ${{ env.CMAKE_AVIF_FLAGS }}
- name: Build libavif (ninja)
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
-DAVIF_CODEC_DAV1D=SYSTEM
-DAVIF_ENABLE_NODISCARD=ON -DAVIF_ENABLE_WERROR=ON
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_GDK_PIXBUF=ON ${{ env.CMAKE_AVIF_FLAGS }}
- name: Build libavif with [[nodiscard]] (ninja)
if: runner.oldest-cmake == 'false'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL
-DAVIF_LIBYUV=${{ matrix.libyuv }}
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static-av2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
-DAVIF_LIBYUV=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_WERROR=ON
- name: Build libavif (ninja)
working-directory: ./build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static-sanitized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
-DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DAV1D=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
env:
CFLAGS: ${{ env.CI_CFLAGS }}
CXXFLAGS: ${{ env.CI_CXXFLAGS }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-unix-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
-DAVIF_CODEC_LIBGAV1=LOCAL
-DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL -DAVIF_LIBYUV=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-installed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
-DAVIF_JPEG=SYSTEM -DAVIF_LIBXML2=SYSTEM
-DAVIF_LIBYUV=SYSTEM -DAVIF_ZLIBPNG=SYSTEM
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows-shared-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
-DAVIF_JPEG=LOCAL -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
-DAVIF_JPEG=LOCAL -DAVIF_LIBSHARPYUV=LOCAL -DAVIF_LIBXML2=LOCAL
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL
-DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL
-DAVIF_ENABLE_EXPERIMENTAL_YCGCO_R=ON
-DAVIF_ENABLE_EXPERIMENTAL_MINI=ON
-DAVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM=ON
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ The changes are relative to the previous release, unless the baseline is specifi
utility functions.
* Turn on the gain map API. Remove the
AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP compile flag.
* Remove AVIF_ENABLE_GTEST CMake option. It's now implied by
AVIF_GTEST=LOCAL/SYSTEM.

## [1.1.1] - 2024-07-30

Expand Down
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ cmake_dependent_option(

set_local_or_system_option(
"GTEST" OFF
"Build the GoogleTest framework by providing your own copy of the repo in ext/googletest (see Local Builds in README)"
"Use the GoogleTest framework. Enables avif C++ tests that depend on GoogleTest. Has no effect unless AVIF_BUILD_TESTS is ON."
)

option(AVIF_BUILD_APPS "Build avif apps." OFF)
option(AVIF_BUILD_TESTS "Build avif tests." OFF)
option(
Expand All @@ -141,9 +142,6 @@ option(
"Build tests that compare encoding outputs to golden files. Needs AVIF_BUILD_APPS=ON and AVIF_BUILD_TESTS=ON, and depends on MP4box which can be built with ext/mp4box.sh"
OFF
)
option(AVIF_ENABLE_GTEST
"Build avif C++ tests, which depend on GoogleTest. Requires GoogleTest. Has no effect unless AVIF_BUILD_TESTS is ON." ON
)
option(AVIF_ENABLE_FUZZTEST "Build avif fuzztest targets. Requires Google FuzzTest. Has no effect unless AVIF_BUILD_TESTS is ON."
OFF
)
Expand Down Expand Up @@ -572,9 +570,7 @@ if(NOT AVIF_CODEC_AOM_ENABLED
message(WARNING "libavif: No decoding library is enabled.")
endif()

if(AVIF_LIB_USE_CXX OR AVIF_BUILD_APPS OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST
OR AVIF_ENABLE_GTEST))
)
if(AVIF_LIB_USE_CXX OR AVIF_BUILD_APPS OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST OR AVIF_GTEST)))
enable_language(CXX)
if(AVIF_ENABLE_NODISCARD)
# [[nodiscard]] requires C++17.
Expand Down Expand Up @@ -651,7 +647,7 @@ if(NOT SKIP_INSTALL_ALL)
include(GNUInstallDirs)
endif()

if(AVIF_BUILD_APPS OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST OR AVIF_ENABLE_GTEST)))
if(AVIF_BUILD_APPS OR (AVIF_BUILD_TESTS AND (AVIF_ENABLE_FUZZTEST OR AVIF_GTEST)))
if(AVIF_ZLIBPNG STREQUAL "OFF")
message(FATAL_ERROR "libavif: AVIF_ZLIBPNG cannot be OFF when AVIF_BUILD_APPS or AVIF_BUILD_TESTS is ON")
elseif(AVIF_ZLIBPNG STREQUAL "SYSTEM")
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ first run the associated script in the `ext/` subdirectory.
A few tests written in C can be built by enabling the `AVIF_BUILD_TESTS` CMake
option.

The remaining tests can be built by enabling the `AVIF_BUILD_TESTS` and
`AVIF_ENABLE_GTEST` CMake options. They require GoogleTest
(`-DAVIF_GTEST=SYSTEM` or `-DAVIF_GTEST=LOCAL`).
The remaining tests can be built by enabling `AVIF_BUILD_TESTS` and setting
`AVIF_GTEST` to `SYSTEM` or `LOCAL`.

### Command Lines

Expand Down
12 changes: 6 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ foreach(AVIFYUV_MODE limited rgb) # Modes drift and premultiply take more than 2
add_test(NAME avifyuv_${AVIFYUV_MODE} COMMAND avifyuv -m ${AVIFYUV_MODE})
endforeach()

if(AVIF_ENABLE_FUZZTEST OR AVIF_ENABLE_GTEST OR AVIF_BUILD_APPS)
if(AVIF_ENABLE_FUZZTEST OR AVIF_GTEST OR AVIF_BUILD_APPS)
add_library(aviftest_helpers OBJECT gtest/aviftest_helpers.cc)
target_link_libraries(aviftest_helpers PUBLIC avif_apps avif)
target_link_libraries(aviftest_helpers PRIVATE avif_enable_warnings)
Expand Down Expand Up @@ -82,7 +82,7 @@ macro(add_avif_internal_gtest_with_data TEST_NAME)
register_test_for_coverage(${TEST_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/data/)
endmacro()

if(AVIF_ENABLE_GTEST)
if(AVIF_GTEST)
check_avif_option(AVIF_GTEST TARGET GTest::GTest PKG_NAME GTest)
add_library(avifincrtest_helpers OBJECT gtest/avifincrtest_helpers.cc)
target_link_libraries(avifincrtest_helpers PUBLIC avif)
Expand All @@ -92,7 +92,7 @@ if(AVIF_ENABLE_GTEST)
target_link_libraries(avifincrtest_helpers_internal PRIVATE GTest::GTest avif_enable_warnings)
endif()

if(AVIF_ENABLE_GTEST)
if(AVIF_GTEST)
if(AVIF_ENABLE_EXPERIMENTAL_SAMPLE_TRANSFORM)
add_avif_internal_gtest_with_data(avif16bittest)
add_avif_internal_gtest(avifsampletransformtest)
Expand Down Expand Up @@ -163,7 +163,7 @@ if(AVIF_ENABLE_GTEST)
message(STATUS "Some tests are skipped because libsharpyuv is unavailable.")
endif()
else()
message(STATUS "Most tests are disabled because AVIF_ENABLE_GTEST is OFF.")
message(STATUS "Most tests are disabled because AVIF_GTEST is OFF.")
endif()

################################################################################
Expand Down Expand Up @@ -319,7 +319,7 @@ endif()
# AV2 tests

if(AVIF_CODEC_AVM_ENABLED)
if(AVIF_ENABLE_GTEST)
if(AVIF_GTEST)
add_avif_gtest(avifavmtest)
if(AVIF_ENABLE_EXPERIMENTAL_MINI)
add_avif_gtest(avifavmminitest)
Expand All @@ -343,7 +343,7 @@ if(AVIF_CODEC_AVM_ENABLED)
)
# Disable all tests that use avifEncoder without explicitly setting the codec to avm.
set_tests_properties(aviftest PROPERTIES DISABLED True)
if(AVIF_ENABLE_GTEST)
if(AVIF_GTEST)
set_tests_properties(
avifallocationtest
avifbasictest
Expand Down
2 changes: 1 addition & 1 deletion tests/oss-fuzz/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ cmake .. -G Ninja -DBUILD_SHARED_LIBS=OFF -DAVIF_CODEC_AOM=LOCAL -DAVIF_CODEC_DA
-DAVIF_LOCAL_FUZZTEST=ON \
-DAVIF_JPEG=LOCAL -DAVIF_LIBSHARPYUV=LOCAL \
-DAVIF_LIBYUV=LOCAL -DAVIF_ZLIBPNG=LOCAL \
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=OFF -DAVIF_ENABLE_WERROR=ON \
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=OFF -DAVIF_ENABLE_WERROR=ON \
${EXTRA_CMAKE_FLAGS}

ninja
Expand Down
4 changes: 2 additions & 2 deletions tests/test_all_configurations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ for BUILD_TYPE in Debug Release; do
pushd build_${BUILD_TYPE}
cmake .. \
-DAVIF_BUILD_APPS=ON -DAVIF_BUILD_EXAMPLES=ON \
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL \
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL \
-DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON \
-DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON \
-DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL \
Expand Down Expand Up @@ -79,7 +79,7 @@ for BUILD_TYPE in Debug Release; do
CC=clang CXX=clang++ CFLAGS=-fsanitize=${SANITIZER} CXXFLAGS=-fsanitize=${SANITIZER} LDFLAGS=-fsanitize=${SANITIZER} \
cmake .. \
-DAVIF_BUILD_APPS=ON -DAVIF_BUILD_EXAMPLES=ON \
-DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_GTEST=LOCAL \
-DAVIF_BUILD_TESTS=ON -DAVIF_GTEST=LOCAL \
-DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON \
-DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON \
-DAVIF_LIBYUV=LOCAL -DAVIF_LIBSHARPYUV=LOCAL \
Expand Down

0 comments on commit b808fa0

Please sign in to comment.