Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace FUZZTEST_STACK_LIMIT by --stack_limit_kb #2470

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ if(AVIF_ENABLE_FUZZTEST)
# FuzzTest bundles GoogleTest so no need to link to gtest librairies.
target_link_libraries(${TEST_NAME} PRIVATE avif_fuzztest_helpers aviftest_helpers_internal avif_enable_warnings)
link_fuzztest(${TEST_NAME})
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} --stack_limit_kb=512)
set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT "TEST_DATA_DIRS=${CMAKE_CURRENT_SOURCE_DIR}/data/")
endmacro()

Expand Down Expand Up @@ -218,15 +218,14 @@ if(AVIF_ENABLE_FUZZTEST)
add_avif_fuzztest(avif_fuzztest_dec_incr gtest/avifincrtest_helpers.cc)
add_avif_fuzztest(avif_fuzztest_enc_dec)
add_avif_fuzztest(avif_fuzztest_enc_dec_anim)
add_avif_fuzztest(avif_fuzztest_enc_dec_incr gtest/avifincrtest_helpers.cc)
add_avif_fuzztest(avif_fuzztest_read_image)
add_avif_fuzztest(avif_fuzztest_yuvrgb)

if(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
add_avif_fuzztest(avif_fuzztest_enc_dec_experimental)
add_avif_fuzztest(avif_fuzztest_enc_dec_incr_experimental gtest/avifincrtest_helpers.cc)
endif()

add_avif_fuzztest(avif_fuzztest_enc_dec_incr gtest/avifincrtest_helpers.cc)
else()
message(STATUS "FuzzTest targets are disabled because AVIF_ENABLE_FUZZTEST is OFF.")
endif()
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_dec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

//------------------------------------------------------------------------------

void Decode(const std::string& arbitrary_bytes, bool is_persistent,
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_dec_incr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

//------------------------------------------------------------------------------

struct DecoderInput {
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_enc_dec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

void EncodeDecodeValid(ImagePtr image, EncoderPtr encoder, DecoderPtr decoder) {
ImagePtr decoded_image(avifImageCreateEmpty());
ASSERT_NE(image.get(), nullptr);
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_enc_dec_anim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

struct FrameOptions {
uint64_t duration;
avifAddImageFlags flags;
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_enc_dec_experimental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

void CheckGainMapMetadataMatches(const avifGainMap& actual,
const avifGainMap& expected) {
EXPECT_EQ(actual.baseHdrHeadroom.n, expected.baseHdrHeadroom.n);
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_enc_dec_incr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

// Encodes an image into an AVIF grid then decodes it.
void EncodeDecodeGridValid(ImagePtr image, EncoderPtr encoder,
DecoderPtr decoder, uint32_t grid_cols,
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_enc_dec_incr_experimental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

// Encodes an image into an AVIF grid then decodes it.
void EncodeDecodeGridValid(ImagePtr image, EncoderPtr encoder,
DecoderPtr decoder, uint32_t grid_cols,
Expand Down
4 changes: 0 additions & 4 deletions tests/gtest/avif_fuzztest_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ class Environment : public ::testing::Environment {
};
} // namespace

::testing::Environment* SetEnv(const char* name, const char* value) {
return ::testing::AddGlobalTestEnvironment(new Environment(name, value));
}

//------------------------------------------------------------------------------

std::vector<std::string> GetSeedDataDirs() {
Expand Down
10 changes: 0 additions & 10 deletions tests/gtest/avif_fuzztest_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ inline auto ArbitraryAvifDecoder() {
inline auto ArbitraryAvifDecoder() { return ArbitraryBaseAvifDecoder(); }
#endif // AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP

//------------------------------------------------------------------------------
// Environment setup

// Sets the environment variable 'name' to the 'value' during the setup step.
::testing::Environment* SetEnv(const char* name, const char* value);

inline ::testing::Environment* SetStackLimitTo512x1024Bytes() {
return SetEnv("FUZZTEST_STACK_LIMIT", "524288");
}

//------------------------------------------------------------------------------

// Returns the paths contained in the 'TEST_DATA_DIRS' environment variable.
Expand Down
2 changes: 0 additions & 2 deletions tests/gtest/avif_fuzztest_read_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ namespace avif {
namespace testutil {
namespace {

::testing::Environment* const kStackLimitEnv = SetStackLimitTo512x1024Bytes();

//------------------------------------------------------------------------------

std::string FileFormatToString(avifAppFileFormat file_format) {
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 @@ -107,7 +107,7 @@ if [[ "$FUZZING_ENGINE" == "libfuzzer" ]]; then
this_dir=\$(dirname \"\$0\")
export TEST_DATA_DIRS=\$this_dir/corpus
chmod +x \$this_dir/$fuzz_basename
\$this_dir/$fuzz_basename --fuzz=$fuzz_entrypoint -- \$@
\$this_dir/$fuzz_basename --fuzz=$fuzz_entrypoint --stack_limit_kb=512 -- \$@
chmod -x \$this_dir/$fuzz_basename" > $OUT/$TARGET_FUZZER
chmod +x $OUT/$TARGET_FUZZER
done
Expand Down
Loading