1# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Mojo fuzzing tools
6
7import("//build/config/features.gni")
8import("//mojo/public/tools/bindings/mojom.gni")
9import("//testing/libfuzzer/fuzzer_test.gni")
10import("//third_party/protobuf/proto_library.gni")
11
12# mojo/public BUILD depends on this target. Needed for package discovery
13group("fuzzers") {
14}
15
16mojom("fuzz_mojom") {
17  sources = [
18    "fuzz.mojom",
19  ]
20}
21
22fuzzer_test("mojo_parse_message_fuzzer") {
23  sources = [
24    "fuzz_impl.cc",
25    "mojo_parse_message_fuzzer.cc",
26  ]
27  deps = [
28    ":fuzz_mojom",
29    "//mojo/core/embedder",
30  ]
31  seed_corpus = "//mojo/public/tools/fuzzers/message_corpus"
32}
33
34# MessageDumper is not meant to work on Windows.
35if (!is_win) {
36  executable("mojo_fuzzer_message_dump") {
37    sources = [
38      "fuzz_impl.cc",
39      "mojo_fuzzer_message_dump.cc",
40    ]
41    deps = [
42      ":fuzz_mojom",
43      "//base",
44      "//mojo/core/embedder",
45    ]
46  }
47}
48
49fuzzer_test("mojo_parse_message_proto_fuzzer") {
50  sources = [
51    "fuzz_impl.cc",
52    "mojo_parse_message_proto_fuzzer.cc",
53  ]
54  deps = [
55    ":fuzz_mojom",
56    ":mojo_fuzzer_proto",
57    "//mojo/core/embedder",
58    "//third_party/libprotobuf-mutator",
59  ]
60  seed_corpus = "//mojo/public/tools/fuzzers/mojo_parse_message_proto_corpus"
61}
62
63proto_library("mojo_fuzzer_proto") {
64  sources = [
65    "mojo_fuzzer.proto",
66  ]
67}
68