Ryan Harrison | 0b5d1dd | 2021-01-12 16:23:48 +0000 | [diff] [blame] | 1 | // 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 Harrison | c57642c | 2021-09-30 18:58:32 +0000 | [diff] [blame] | 17 | #include "fuzzers/fuzzer_init.h" |
Ryan Harrison | 37a666d | 2021-10-12 14:41:20 +0000 | [diff] [blame] | 18 | #include "fuzzers/tint_reader_writer_fuzzer.h" |
Ryan Harrison | 0b5d1dd | 2021-01-12 16:23:48 +0000 | [diff] [blame] | 19 | |
| 20 | namespace tint { |
| 21 | namespace fuzzers { |
| 22 | |
| 23 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
Ryan Harrison | d3f628b | 2021-11-01 18:14:42 +0000 | [diff] [blame] | 24 | DataBuilder db(data, size); |
Ryan Harrison | 18d7e78 | 2021-07-22 13:25:54 +0000 | [diff] [blame] | 25 | writer::msl::Options options; |
Ryan Harrison | d3f628b | 2021-11-01 18:14:42 +0000 | [diff] [blame] | 26 | GenerateMslOptions(&db, &options); |
Ryan Harrison | 37a666d | 2021-10-12 14:41:20 +0000 | [diff] [blame] | 27 | tint::fuzzers::ReaderWriterFuzzer fuzzer(InputFormat::kSpv, |
| 28 | OutputFormat::kMSL); |
Ryan Harrison | 18d7e78 | 2021-07-22 13:25:54 +0000 | [diff] [blame] | 29 | fuzzer.SetOptionsMsl(options); |
Antonio Maiorano | 15e89fa | 2021-08-05 15:52:58 +0000 | [diff] [blame] | 30 | fuzzer.SetDumpInput(GetCliParams().dump_input); |
Ryan Harrison | a617d0f | 2021-09-22 14:37:46 +0000 | [diff] [blame] | 31 | return fuzzer.Run(data, size); |
Ryan Harrison | 0b5d1dd | 2021-01-12 16:23:48 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | } // namespace fuzzers |
| 35 | } // namespace tint |