Aaron Green | f3c3d2b | 2020-04-02 23:12:31 -0700 | [diff] [blame^] | 1 | # Copyright 2020 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://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, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
| 15 | import("$dir_pw_docgen/docs.gni") |
| 16 | import("$dir_pw_fuzzer/fuzzer.gni") |
| 17 | |
| 18 | declare_args() { |
| 19 | # Sets the sanitizer to pass to clang. Valid values are those for "-fsanitize" |
| 20 | # listed in https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html. |
| 21 | pw_sanitizer = "" |
| 22 | } |
| 23 | |
| 24 | # This is added automatically by the `pw_fuzzer` template. |
| 25 | config("pw_fuzzer") { |
| 26 | common_flags = [ "-fsanitize=fuzzer" ] |
| 27 | if (pw_sanitizer != "") { |
| 28 | common_flags += [ "-fsanitize=$pw_sanitizer" ] |
| 29 | } |
| 30 | cflags = common_flags |
| 31 | ldflags = common_flags |
| 32 | } |
| 33 | |
| 34 | pw_doc_group("docs") { |
| 35 | inputs = [ "doc_resources/pw_fuzzer_coverage_guided.png" ] |
| 36 | sources = [ "docs.rst" ] |
| 37 | } |
| 38 | |
| 39 | # Sample fuzzer |
| 40 | pw_fuzzer("toy_fuzzer") { |
| 41 | sources = [ "examples/toy_fuzzer.cc" ] |
| 42 | deps = [ "$dir_pw_string" ] |
| 43 | } |
| 44 | |
| 45 | pw_test_group("tests") { |
| 46 | tests = [ ":toy_fuzzer" ] |
| 47 | } |