Skip to content

Commit

Permalink
Remove gtest_discover_tests() from CMakeLists.txt (AOMediaCodec#1629)
Browse files Browse the repository at this point in the history
It doesn't seem necessary, makes tests appear twice, with one version
sometimes failing supposedly with a double free().

Rename some fuzztest test cases for clarity/consistency.
  • Loading branch information
maryla-uc authored Sep 28, 2023
1 parent e57cc5e commit fc00f1b
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ if(AVIF_ENABLE_GTEST AND AVIF_ENABLE_FUZZTEST)
target_include_directories(${TEST_NAME} PRIVATE ${GTEST_INCLUDE_DIRS})
target_link_libraries(${TEST_NAME} PRIVATE aviftest_helpers ${ARGN})
link_fuzztest(${TEST_NAME})
gtest_discover_tests(${TEST_NAME})
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "TEST_DATA_DIR=${CMAKE_CURRENT_SOURCE_DIR}/data/")
endmacro()
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_dec_incr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void DecodeIncr(const std::vector<uint8_t>& arbitrary_bytes, bool is_persistent,
}
}

FUZZ_TEST(DecodeAvifTest, DecodeIncr)
FUZZ_TEST(DecodeAvifFuzzTest, DecodeIncr)
.WithDomains(Arbitrary<std::vector<uint8_t>>(), Arbitrary<bool>(),
Arbitrary<bool>(), Arbitrary<bool>())
.WithSeeds({{GetWhiteSinglePixelAvif(), false, false, false}});
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_enc_dec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void EncodeDecodeValid(AvifImagePtr image, AvifEncoderPtr encoder,
// hard to verify so do not check it.
}

FUZZ_TEST(EncodeDecodeAvifTest, EncodeDecodeValid)
FUZZ_TEST(EncodeDecodeAvifFuzzTest, EncodeDecodeValid)
.WithDomains(ArbitraryAvifImage(), ArbitraryAvifEncoder(),
ArbitraryAvifDecoder({AVIF_CODEC_CHOICE_AUTO,
AVIF_CODEC_CHOICE_DAV1D}));
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_enc_dec_experimental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ inline auto ArbitraryAvifImageWithGainMap() {
fuzztest::Arbitrary<std::array<uint8_t, sizeof(avifGainMapMetadata)>>());
}

FUZZ_TEST(EncodeDecodeAvifTest8b, EncodeDecodeValid)
FUZZ_TEST(EncodeDecodeAvifFuzzTest, EncodeDecodeValid)
.WithDomains(fuzztest::OneOf(ArbitraryAvifImage(),
ArbitraryAvifImageWithGainMap()),
ArbitraryAvifEncoder(),
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_enc_dec_incr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void EncodeDecodeGridValid(AvifImagePtr image, AvifEncoderPtr encoder,
/*useNthImageApi=*/true, cell_height);
}

FUZZ_TEST(EncodeDecodeAvifTest, EncodeDecodeGridValid)
FUZZ_TEST(EncodeDecodeAvifFuzzTest, EncodeDecodeGridValid)
.WithDomains(ArbitraryAvifImage(), ArbitraryAvifEncoder(),
ArbitraryAvifDecoder({AVIF_CODEC_CHOICE_AUTO}),
/*grid_cols=*/InRange<uint32_t>(1, 32),
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_enc_dec_incr_experimental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ inline auto ArbitraryAvifImageWithGainMap() {
fuzztest::Arbitrary<std::array<uint8_t, sizeof(avifGainMapMetadata)>>());
}

FUZZ_TEST(EncodeDecodeAvifTest, EncodeDecodeGridValid)
FUZZ_TEST(EncodeDecodeAvifFuzzTest, EncodeDecodeGridValid)
.WithDomains(fuzztest::OneOf(ArbitraryAvifImage(),
ArbitraryAvifImageWithGainMap()),
ArbitraryAvifEncoder(),
Expand Down
2 changes: 1 addition & 1 deletion tests/gtest/avif_fuzztest_read_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ReadImageFile(const std::string& arbitrary_bytes,

constexpr uint32_t kMaxFileSize = 1024 * 1024; // 1MB.

FUZZ_TEST(DecodeAvifTest, ReadImageFile)
FUZZ_TEST(ReadImageFuzzTest, ReadImageFile)
.WithDomains(
Arbitrary<std::string>()
.WithMaxSize(kMaxFileSize)
Expand Down

0 comments on commit fc00f1b

Please sign in to comment.