mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
Create common utility class for fuzzing
This moves the usage of Tint in the fuzzers into a single class. This will be expanded in the future to support emitting shaders, so fuzzing tests, just need to indicate which reader & writer they want to use, instead of having each test implement all of the API usage logic directly. BUG=tint:199 Change-Id: Id081a374014b7640a07b267e544ddeba3e6329dd Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36760 Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org> Auto-Submit: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
718975958b
commit
766e31d507
@@ -14,14 +14,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/reader/wgsl/parser.h"
|
||||
#include "fuzzers/tint_common_fuzzer.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
std::string str(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
tint::Source::File file("test.wgsl", str);
|
||||
tint::reader::wgsl::Parser parser(&file);
|
||||
parser.Parse();
|
||||
|
||||
return 0;
|
||||
tint::fuzzers::CommonFuzzer fuzzer(tint::fuzzers::InputFormat::kWGSL);
|
||||
return fuzzer.Run(data, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user