| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/dist/distribution_manifest.gni") |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/fuzzing/fuzzer_package.gni") |
| import("//src/tests/fidl/conformance_suite/gidl-conformance-suite.gni") |
| import("//tools/fidl/gidl/gidl.gni") |
| |
| corpus_label_and_dir = "corpus" |
| |
| # |
| # Fuzzer |
| # |
| |
| fuzzer("conformance-fuzzer") { |
| sources = [ "fuzzer.cc" ] |
| deps = [ |
| "//src/tests/fidl/conformance_suite:conformance_fidl_libfuzzer", |
| "//zircon/system/public", |
| ] |
| |
| corpus = ":$corpus_label_and_dir" |
| } |
| |
| fuzzer_package("fidl-fuzzers") { |
| fuzzers = [ ":conformance-fuzzer" ] |
| } |
| |
| # |
| # Corpus |
| # |
| |
| conformance_test_source = "$target_gen_dir/corpus.distribution_entries" |
| |
| gidl("generate_conformance_test") { |
| type = "conformance" |
| language = "fuzzer_corpus" |
| inputs = conformance_suite_gidl_files |
| fidl = conformance_suite_fidl_target |
| output = conformance_test_source |
| |
| # Fuzzer components expect the seed corpus to be in a package data subdirectory (under `pkg/data`) |
| # that matches the GN label of the corresponding corpus target. |
| extra_args = [ |
| "--fuzzer-corpus-host-dir", |
| |
| # Location from build on host is relative to `root_build_dir`. |
| rebase_path("$target_gen_dir/$corpus_label_and_dir", root_build_dir), |
| "--fuzzer-corpus-package-data-dir", |
| |
| # Location served to device is relative to `root_gen_dir`. |
| rebase_path("$target_gen_dir/$corpus_label_and_dir", root_gen_dir), |
| ] |
| } |
| |
| distribution_entries_file(corpus_label_and_dir) { |
| testonly = true |
| file = conformance_test_source |
| deps = [ ":generate_conformance_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":fidl-fuzzers" ] |
| } |