blob: 20711f1fa7d2a9729a36204767ae22256d352f4f [file] [log] [blame]
# 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/components.gni")
import("//build/fuzz.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_fuzzer.gni")
import("//build/rust/rustc_library.gni")
import("//build/rust/rustc_staticlib.gni")
group("bind") {
public_deps = [ ":lib" ]
}
rustc_library("lib") {
name = "bind"
edition = "2021"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.driver.legacy:fuchsia.driver.legacy_rust",
"//third_party/rust_crates:bitfield",
"//third_party/rust_crates:byteorder",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:nom",
"//third_party/rust_crates:nom_locate",
"//third_party/rust_crates:num-derive",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:valico",
]
test_deps = [ "//third_party/rust_crates:assert_matches" ]
sources = [
"src/bytecode_constants.rs",
"src/bytecode_encoder/bytecode_checker.rs",
"src/bytecode_encoder/debug_encoder.rs",
"src/bytecode_encoder/encode_v1.rs",
"src/bytecode_encoder/encode_v2.rs",
"src/bytecode_encoder/error.rs",
"src/bytecode_encoder/instruction_encoder.rs",
"src/bytecode_encoder/mod.rs",
"src/bytecode_encoder/symbol_table_encoder.rs",
"src/compiler/compiler.rs",
"src/compiler/dependency_graph.rs",
"src/compiler/instruction.rs",
"src/compiler/mod.rs",
"src/compiler/symbol_table.rs",
"src/ddk_bind_constants.rs",
"src/debugger/debug_dump.rs",
"src/debugger/debugger.rs",
"src/debugger/device_specification.rs",
"src/debugger/mod.rs",
"src/debugger/offline_debugger.rs",
"src/errors.rs",
"src/interpreter/common.rs",
"src/interpreter/decode_bind_rules.rs",
"src/interpreter/instruction_decoder.rs",
"src/interpreter/match_bind.rs",
"src/interpreter/mod.rs",
"src/interpreter/test_common.rs",
"src/lib.rs",
"src/linter.rs",
"src/parser/bind_composite.rs",
"src/parser/bind_library.rs",
"src/parser/bind_rules.rs",
"src/parser/common.rs",
"src/parser/mod.rs",
"src/test.rs",
]
inputs = [
"composite_tests_schema.json",
"tests_schema.json",
]
}
rustc_fuzzer("bind_rules_bytecode_fuzzer") {
edition = "2021"
source_root = "src/fuzzer/bytecode_fuzzer.rs"
sources = [ "src/fuzzer/bytecode_fuzzer.rs" ]
deps = [
":lib",
"//src/lib/fuzzing/rust:fuzz",
]
}
rustc_fuzzer("instruction_section_fuzzer") {
edition = "2021"
source_root = "src/fuzzer/bytecode_section_fuzzer.rs"
sources = [ "src/fuzzer/bytecode_section_fuzzer.rs" ]
deps = [
":lib",
"//src/lib/fuzzing/rust:fuzz",
]
}
rustc_fuzzer("symbol_table_section_fuzzer") {
edition = "2021"
source_root = "src/fuzzer/bytecode_section_fuzzer.rs"
sources = [ "src/fuzzer/bytecode_section_fuzzer.rs" ]
deps = [
":lib",
"//src/lib/fuzzing/rust:fuzz",
]
}
fuchsia_fuzzer_component("bind-rules-bytecode-fuzzer-component") {
manifest = "meta/bind_rules_bytecode_fuzzer.cml"
deps = [ ":bind_rules_bytecode_fuzzer" ]
}
fuchsia_fuzzer_component("instruction-section-fuzzer-component") {
manifest = "meta/instruction_section_fuzzer.cml"
deps = [ ":instruction_section_fuzzer" ]
}
fuchsia_fuzzer_component("symbol-table-section-fuzzer-component") {
manifest = "meta/symbol_table_section_fuzzer.cml"
deps = [ ":symbol_table_section_fuzzer" ]
}
fuchsia_fuzzer_package("bind-fuzzers") {
rust_fuzzer_components = [
":bind-rules-bytecode-fuzzer-component",
":instruction-section-fuzzer-component",
":symbol-table-section-fuzzer-component",
]
}
fuchsia_unittest_package("bind_tests") {
deps = [ ":lib_test" ]
test_specs = {
environments = basic_envs
}
}
group("tests") {
testonly = true
deps = [
":bind-fuzzers",
":bind_tests",
]
}