| # | |
| # Copyright 2020 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # Simple fuzz targets that demonstrate the Bazel extension functionality and serve as regression tests. | |
| load("//fuzzing:cc_deps.bzl", "cc_fuzz_test") | |
| cc_fuzz_test( | |
| name = "empty_fuzz_test", | |
| srcs = ["empty_fuzz_test.cc"], | |
| ) | |
| filegroup( | |
| name = "corpus_filegroup", | |
| srcs = ["corpus_1.txt"] + glob(["corpus_dir/**"]), | |
| ) | |
| # This target shows how to create a fuzz test target with corpus files. | |
| cc_fuzz_test( | |
| name = "empty_fuzz_test_with_corpus", | |
| srcs = ["empty_fuzz_test.cc"], | |
| corpus = [ | |
| "corpus_0.txt", | |
| ":corpus_filegroup", | |
| "test_corpus_dir", | |
| ], | |
| ) | |
| # This target shows how to create a fuzz test target with dictionaries. | |
| cc_fuzz_test( | |
| name = "empty_fuzz_test_with_dict", | |
| srcs = ["empty_fuzz_test.cc"], | |
| corpus = [ | |
| "corpus_0.txt", | |
| ":corpus_filegroup", | |
| "test_corpus_dir", | |
| ], | |
| dicts = ["dict_dir/valid.dict"], | |
| ) | |
| cc_fuzz_test( | |
| name = "fuzzed_data_provider_fuzz_test", | |
| srcs = ["fuzzed_data_provider_fuzz_test.cc"], | |
| tags = ["FDP"], | |
| ) | |
| cc_fuzz_test( | |
| name = "hang_fuzz_test", | |
| srcs = ["hang_fuzz_test.cc"], | |
| ) | |
| cc_fuzz_test( | |
| name = "input_buffer_overflow_fuzz_test", | |
| srcs = ["input_buffer_overflow_fuzz_test.cc"], | |
| ) | |
| # This test is designed to trigger an uninitialized memory issue. | |
| cc_fuzz_test( | |
| name = "msan_fuzz_test", | |
| srcs = ["msan_fuzz_test.cc"], | |
| copts = ["-Wno-uninitialized"], | |
| ) | |
| cc_fuzz_test( | |
| name = "new_buffer_overflow_fuzz_test", | |
| srcs = ["new_buffer_overflow_fuzz_test.cc"], | |
| ) | |
| cc_fuzz_test( | |
| name = "oom_fuzz_test", | |
| srcs = ["oom_fuzz_test.cc"], | |
| ) | |
| cc_fuzz_test( | |
| name = "re2_fuzz_test", | |
| srcs = ["re2_fuzz_test.cc"], | |
| deps = [ | |
| "@re2", | |
| ], | |
| ) |