blob: 8b63e26231bcb3b591ca9a1ea896879e9350ebdc [file] [log] [blame]
Ryan Harrison0b5d1dd2021-01-12 16:23:48 +00001// Copyright 2021 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include <vector>
16
Ryan Harrisonc57642c2021-09-30 18:58:32 +000017#include "fuzzers/fuzzer_init.h"
Ryan Harrison37a666d2021-10-12 14:41:20 +000018#include "fuzzers/tint_reader_writer_fuzzer.h"
Ryan Harrison0b5d1dd2021-01-12 16:23:48 +000019
20namespace tint {
21namespace fuzzers {
22
23extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
Ryan Harrisond3f628b2021-11-01 18:14:42 +000024 DataBuilder db(data, size);
Ryan Harrison18d7e782021-07-22 13:25:54 +000025 writer::msl::Options options;
Ryan Harrisond3f628b2021-11-01 18:14:42 +000026 GenerateMslOptions(&db, &options);
Ryan Harrison37a666d2021-10-12 14:41:20 +000027 tint::fuzzers::ReaderWriterFuzzer fuzzer(InputFormat::kSpv,
28 OutputFormat::kMSL);
Ryan Harrison18d7e782021-07-22 13:25:54 +000029 fuzzer.SetOptionsMsl(options);
Antonio Maiorano15e89fa2021-08-05 15:52:58 +000030 fuzzer.SetDumpInput(GetCliParams().dump_input);
Ryan Harrisona617d0f2021-09-22 14:37:46 +000031 return fuzzer.Run(data, size);
Ryan Harrison0b5d1dd2021-01-12 16:23:48 +000032}
33
34} // namespace fuzzers
35} // namespace tint