From 54b0e73cb9140a63968146a1581754bba2a47d10 Mon Sep 17 00:00:00 2001 From: "liang.he" Date: Wed, 12 Jun 2024 11:13:22 +0800 Subject: [PATCH] wasm-mutator-fuzz: Use another variable to check if in oss-fuzz environment (#3518) In order to pass a oss-fuzz build step *check_build*. Previous `HELPER` is only for local test. --- tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt b/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt index 084b39911..44de74084 100644 --- a/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt +++ b/tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt @@ -120,8 +120,11 @@ add_compile_options(-fsanitize=fuzzer) add_link_options(-fsanitize=fuzzer) # if not calling from oss-fuzz helper, enable all support sanitizers -# oss-fuzz always defines `HELPER=True` -if (NOT "$ENV{HELPER}" STREQUAL "True") +# oss-fuzz will define FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION in CFLAGS and CXXFLAGS +set(CFLAGS_ENV $ENV{CFLAGS}) +string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" IN_OSS_FUZZ) +if (IN_OSS_FUZZ EQUAL -1) + message("[ceith]:Enable ASan and UBSan in non-oss-fuzz environment") add_compile_options( -fsanitize=signed-integer-overflow -fprofile-instr-generate -fcoverage-mapping