Skip to content

Commit 8b2c0df

Browse files
committed
fuzz: Add option to ignore errors
1 parent cdd3dbd commit 8b2c0df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/fuzzer/parser_fuzzer.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
#include "parser.hpp"
6+
#include <cstdlib>
67
#include <iomanip>
78
#include <iostream>
89

@@ -36,7 +37,14 @@ Stats stats;
3637

3738
void handle_unexpected_errors() noexcept
3839
{
39-
__builtin_trap();
40+
static const bool ignore_errors = [] {
41+
const auto options = std::getenv("OPTIONS");
42+
if (!options)
43+
return false;
44+
return std::string{options}.find("ignore_errors") != std::string::npos;
45+
}();
46+
if (!ignore_errors)
47+
__builtin_trap();
4048
}
4149

4250
constexpr auto wabt_ignored_errors = {

0 commit comments

Comments
 (0)