diff options
Diffstat (limited to 'libcxx/fuzzing/fuzz_test_template.cpp')
| -rw-r--r-- | libcxx/fuzzing/fuzz_test_template.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libcxx/fuzzing/fuzz_test_template.cpp b/libcxx/fuzzing/fuzz_test_template.cpp new file mode 100644 index 00000000000..ba44eef7891 --- /dev/null +++ b/libcxx/fuzzing/fuzz_test_template.cpp @@ -0,0 +1,22 @@ +//===------------------------- fuzz_test.cpp ------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "fuzzing/fuzzing.h" +#ifdef NDEBUG +#undef NDEBUG +#endif +#include <cassert> + +#ifndef TEST_FUNCTION +#error TEST_FUNCTION must be defined +#endif + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + int result = fuzzing::TEST_FUNCTION(data, size); + assert(result == 0); return 0; +} |

