pw_fuzzer: Add module

This CL adds fuzzing support, in the form of GN logic, docs, and an
example fuzzer.

You can run this fuzzer with the following:
$ pw_fuzzer/examples/build_and_run_toy_fuzzer.sh

This is rather bare-bones at the moment. Additional features, like
corpus and dictionary integration, more sanitizers, etc. are follow-on
work.

Change-Id: I7fb4d5ecbb59d1e9b69f4594db4222728b8da2f9
diff --git a/pw_fuzzer/BUILD.gn b/pw_fuzzer/BUILD.gn
new file mode 100644
index 0000000..36f4cb4
--- /dev/null
+++ b/pw_fuzzer/BUILD.gn
@@ -0,0 +1,47 @@
+# Copyright 2020 The Pigweed Authors
+#
+# 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.
+
+import("$dir_pw_docgen/docs.gni")
+import("$dir_pw_fuzzer/fuzzer.gni")
+
+declare_args() {
+  # Sets the sanitizer to pass to clang. Valid values are those for "-fsanitize"
+  # listed in https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html.
+  pw_sanitizer = ""
+}
+
+# This is added automatically by the `pw_fuzzer` template.
+config("pw_fuzzer") {
+  common_flags = [ "-fsanitize=fuzzer" ]
+  if (pw_sanitizer != "") {
+    common_flags += [ "-fsanitize=$pw_sanitizer" ]
+  }
+  cflags = common_flags
+  ldflags = common_flags
+}
+
+pw_doc_group("docs") {
+  inputs = [ "doc_resources/pw_fuzzer_coverage_guided.png" ]
+  sources = [ "docs.rst" ]
+}
+
+# Sample fuzzer
+pw_fuzzer("toy_fuzzer") {
+  sources = [ "examples/toy_fuzzer.cc" ]
+  deps = [ "$dir_pw_string" ]
+}
+
+pw_test_group("tests") {
+  tests = [ ":toy_fuzzer" ]
+}