Reduce fuzzer log spam

When fuzzing, silence all LogMessages as errors frequently come up.
Suppressing logs should make the fuzzer more efficient.

Bug: none
Change-Id: I827625446c2afc3771ebf14d676b4e211d99dbda
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91601
Reviewed-by: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2022-05-26 22:03:55 +00:00 committed by Dawn LUCI CQ
parent e6c03a3799
commit a2792b38d1
2 changed files with 12 additions and 2 deletions

View File

@ -49,8 +49,13 @@ config("internal_config") {
} }
if (use_fuzzing_engine) { if (use_fuzzing_engine) {
# Does a hard abort when an assertion fails so that fuzzers catch and parse the failure. defines += [
defines += [ "DAWN_ABORT_ON_ASSERT" ] # Does a hard abort when an assertion fails so that fuzzers catch and parse the failure.
"DAWN_ABORT_ON_ASSERT",
# Disable logging to make fuzzing more efficient.
"DAWN_DISABLE_LOGGING",
]
} }
if (dawn_enable_d3d12) { if (dawn_enable_d3d12) {

View File

@ -71,6 +71,11 @@ LogMessage::LogMessage(LogMessage&& other) = default;
LogMessage& LogMessage::operator=(LogMessage&& other) = default; LogMessage& LogMessage::operator=(LogMessage&& other) = default;
LogMessage::~LogMessage() { LogMessage::~LogMessage() {
#if defined(DAWN_DISABLE_LOGGING)
// Don't print logs to make fuzzing more efficient. Implemented as
// an early return to avoid warnings about unused member variables.
return;
#endif
std::string fullMessage = mStream.str(); std::string fullMessage = mStream.str();
// If this message has been moved, its stream is empty. // If this message has been moved, its stream is empty.