Extend chrome_tint_wgsl_fuzzer to fuzz tint::wgsl::reader::WgslToIR
Change-Id: I524fe5ae9f2c47756d130a2025dedb84ab410f04 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6309016 Reviewed-by: Paul Semel <paulsemel@chromium.org> Commit-Queue: Ali Hijazi <ahijazi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1427013}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
1515742dfe
commit
5e135b9e26
testing/libfuzzer/fuzzers
@ -484,7 +484,10 @@ test("chrome_tint_wgsl_fuzzer") {
|
||||
"tint_wgsl_fuzzer.cc",
|
||||
"tint_wgsl_fuzzer_grammar.h",
|
||||
]
|
||||
fuzztests = [ "ChromiumTintWgslTest.CanParseWithoutCrashing" ]
|
||||
fuzztests = [
|
||||
"ChromiumTintWgslTest.CanParseWithoutCrashing",
|
||||
"ChromiumTintWgslTest.CanConvertWgslToIRWithoutCrashing",
|
||||
]
|
||||
fuzztest_stack_limit_kb = 512
|
||||
|
||||
deps = [
|
||||
|
@ -13,5 +13,15 @@ void CanParseWithoutCrashing(std::string_view wgsl) {
|
||||
auto program = tint::wgsl::reader::Parse(&file, parse_options);
|
||||
}
|
||||
|
||||
void CanConvertWgslToIRWithoutCrashing(std::string_view wgsl) {
|
||||
tint::Source::File file("test.wgsl", wgsl);
|
||||
tint::wgsl::reader::Options parse_options;
|
||||
parse_options.allowed_features = tint::wgsl::AllowedFeatures::Everything();
|
||||
auto module = tint::wgsl::reader::WgslToIR(&file, parse_options);
|
||||
}
|
||||
|
||||
FUZZ_TEST(ChromiumTintWgslTest, CanParseWithoutCrashing)
|
||||
.WithDomains(fuzztest::InWgslGrammar());
|
||||
|
||||
FUZZ_TEST(ChromiumTintWgslTest, CanConvertWgslToIRWithoutCrashing)
|
||||
.WithDomains(fuzztest::InWgslGrammar());
|
||||
|
Reference in New Issue
Block a user