From 8b2c0df212eba7e7a7d06fa3e2be9636a9ce5396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 3 Aug 2020 08:33:09 +0200 Subject: [PATCH] fuzz: Add option to ignore errors --- test/fuzzer/parser_fuzzer.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/fuzzer/parser_fuzzer.cpp b/test/fuzzer/parser_fuzzer.cpp index 59814252a2..e9c346b708 100644 --- a/test/fuzzer/parser_fuzzer.cpp +++ b/test/fuzzer/parser_fuzzer.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "parser.hpp" +#include #include #include @@ -36,7 +37,14 @@ Stats stats; void handle_unexpected_errors() noexcept { - __builtin_trap(); + static const bool ignore_errors = [] { + const auto options = std::getenv("OPTIONS"); + if (!options) + return false; + return std::string{options}.find("ignore_errors") != std::string::npos; + }(); + if (!ignore_errors) + __builtin_trap(); } constexpr auto wabt_ignored_errors = {