Skip to content
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
18 changes: 7 additions & 11 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -277,22 +277,18 @@ build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com
build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com

# Fuzz builds
# -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is passed in in the bazel build target
# rules for fuzz tests. Passing it in the CLI will cause dependencies to be build
# with the macro. Causing issues in RouteMatcherTest.TestRoutes that expect prod
# behavior from RE2 library.
build:asan-fuzzer --config=asan
build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link
build:asan-fuzzer --copt=-fno-omit-frame-pointer
# Remove UBSAN halt_on_error to avoid crashing on protobuf errors.
build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1

# Fuzzing without ASAN. This is useful for profiling fuzzers without any ASAN artifacts.
build:plain-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:plain-fuzzer --define ENVOY_CONFIG_ASAN=1
build:plain-fuzzer --copt=-fsanitize=fuzzer-no-link
build:plain-fuzzer --linkopt=-fsanitize=fuzzer-no-link
build:plain-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION

build:asan-fuzzer --config=plain-fuzzer
build:asan-fuzzer --config=asan
build:asan-fuzzer --copt=-fno-omit-frame-pointer
# Remove UBSAN halt_on_error to avoid crashing on protobuf errors.
build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1

# Compile database generation config
build:compdb --build_tag_filters=-nocompdb
Expand Down
10 changes: 10 additions & 0 deletions test/test_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,17 @@ int TestRunner::RunTests(int argc, char** argv) {
file_logger = std::make_unique<Logger::FileSinkDelegate>(
TestEnvironment::getOptions().logPath(), access_log_manager, Logger::Registry::getSink());
}

#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
// Fuzz tests may run Envoy tests in fuzzing mode to generate corpora. In this case, we do not
// want to fail building the fuzz test because of a failed test run, which can happen when testing
// functionality in fuzzing test mode. Dependencies (like RE2) change behavior when in fuzzing
// mode, so we do not want to rely on a behavior test when generating a corpus.
(void)RUN_ALL_TESTS();
return 0;
#else
return RUN_ALL_TESTS();
#endif
}

} // namespace Envoy