| # Copyright 2021 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/components.gni") | |
| import("//build/config/sanitizers/sanitizer_default_options.gni") | |
| import("//build/test.gni") | |
| import("//tools/cmc/build/expect_includes.gni") | |
| group("libfuzzer") { | |
| testonly = true | |
| deps = [ | |
| ":engine-bin", | |
| ":libfuzzer_includes", | |
| ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| deps = [ | |
| ":unittests-pkg", | |
| "tests", | |
| ] | |
| } | |
| # The libFuzzer stats conversions are built separately to allow their use by | |
| # realmfuzzer et al. | |
| source_set("stats-lib") { | |
| testonly = true | |
| sources = [ | |
| "stats.cc", | |
| "stats.h", | |
| ] | |
| public_deps = [ | |
| "//src/sys/fuzzing/fidl:fuchsia.fuzzer_hlcpp", | |
| "//third_party/re2", | |
| ] | |
| deps = [ | |
| "//sdk/lib/syslog/cpp", | |
| "//src/lib/files", | |
| ] | |
| } | |
| source_set("engine-lib") { | |
| visibility = [ ":*" ] | |
| testonly = true | |
| sources = [ | |
| "runner.cc", | |
| "runner.h", | |
| ] | |
| public_deps = [ | |
| "//sdk/lib/fdio", | |
| "//sdk/lib/fit", | |
| "//src/sys/fuzzing/common", | |
| "//src/sys/fuzzing/fidl:fuchsia.fuzzer_hlcpp", | |
| "//third_party/re2", | |
| ] | |
| deps = [ | |
| ":stats-lib", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/lib/files", | |
| "//third_party/boringssl", | |
| ] | |
| } | |
| executable("engine-bin") { | |
| output_name = "libfuzzer_engine" | |
| testonly = true | |
| sources = [ "engine-main.cc" ] | |
| deps = [ ":engine-lib" ] | |
| } | |
| test("unittests-bin") { | |
| output_name = "libfuzzer_unittests" | |
| visibility = [ ":*" ] | |
| testonly = true | |
| sources = [ | |
| "runner-unittest.cc", | |
| "stats-unittest.cc", | |
| ] | |
| deps = [ | |
| ":engine-lib", | |
| ":stats-lib", | |
| "testing:data", | |
| "testing:test.fuzzer_hlcpp", | |
| "//sdk/lib/sys/cpp", | |
| "//src/lib/files", | |
| "//src/lib/fxl", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/sys/fuzzing/common:runner-unittests", | |
| "//src/sys/fuzzing/common/testing", | |
| "//third_party/googletest:gtest", | |
| ] | |
| } | |
| expect_includes("libfuzzer_includes") { | |
| includes = [ "default.shard.cml" ] | |
| } | |
| expect_includes("libfuzzer_starnix_includes") { | |
| includes = [ "starnix.shard.cml" ] | |
| } | |
| fuchsia_component("test-realm") { | |
| visibility = [ ":*" ] | |
| testonly = true | |
| manifest = "meta/test-realm.cml" | |
| deps = [ | |
| ":test-relay", | |
| ":unittests", | |
| ] | |
| } | |
| fuchsia_component("test-relay") { | |
| visibility = [ ":*" ] | |
| testonly = true | |
| manifest = "meta/test-relay.cml" | |
| deps = [ "testing:relay" ] | |
| } | |
| fuchsia_component("unittests") { | |
| visibility = [ ":*" ] | |
| testonly = true | |
| manifest = "meta/unittests.cml" | |
| deps = [ | |
| ":unittests-bin", | |
| "testing:fuzzer", | |
| ] | |
| } | |
| fuchsia_test_package("unittests-pkg") { | |
| package_name = "libfuzzer-unittests" | |
| test_components = [ ":test-realm" ] | |
| } |