blob: 95ff9701968625ccf1207d689fbdc3b72e9c3375 [file] [log] [blame]
# Copyright 2022 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/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
rustc_library("lib") {
name = "fuchsia_fuzzctl"
with_unit_tests = true
edition = "2021"
sources = [
"src/artifact.rs",
"src/constants.rs",
"src/controller.rs",
"src/corpus.rs",
"src/diagnostics.rs",
"src/duration.rs",
"src/input.rs",
"src/lib.rs",
"src/manager.rs",
"src/util.rs",
"src/writer.rs",
]
deps = [
"//src/lib/diagnostics/data",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/zircon/rust:fuchsia-zircon-status",
"//src/sys/fuzzing/fidl:fuchsia.fuzzer_rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:hex",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:sha2",
"//third_party/rust_crates:termion",
"//third_party/rust_crates:url",
]
# This target includes tests which depend on the test fixtures, which in turn depend on the
# library. If the tests also refer to code in the library the normal way, i.e. `use crate::...`,
# then Rust is unable to determine that the code is identical to what the test fixtures are using
# and complains. The workaround is to have the test depend on the library explicitly, and
# `use fuchsia_fuzzctl::...` where necessary.
test_deps = [
":lib",
"testing",
"//src/lib/fuchsia",
]
}
rustc_binary("bin") {
name = "fuzz_ctl"
with_unit_tests = true
edition = "2021"
testonly = true
sources = [
"src/args.rs",
"src/fuzzctl.rs",
"src/main.rs",
]
deps = [
":lib",
"//build/validate:non_production_tag",
"//src/lib/fuchsia",
"//src/lib/fuchsia-component",
"//src/sys/fuzzing/fidl:fuchsia.fuzzer_rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:url",
"//third_party/rust_crates:walkdir",
]
test_deps = [
"testing",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/zircon/rust:fuchsia-zircon",
]
}
fuchsia_shell_package("fuzzctl") {
testonly = true
deps = [ ":bin" ]
}
fuchsia_test_component("bin-unittests") {
manifest = "meta/bin-unittests.cml"
deps = [ ":bin_test" ]
}
fuchsia_test_component("lib-unittests") {
manifest = "meta/lib-unittests.cml"
deps = [ ":lib_test" ]
}
fuchsia_test_package("tests") {
package_name = "fuzzctl-tests"
test_components = [
":bin-unittests",
":lib-unittests",
]
}