| # Copyright 2019 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/fuchsia/target_api_level.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/fuzz.gni") |
| import("//build/rust/rustc_fuzzer.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":diagnostics-log-encoding-fuzzers", |
| ":diagnostics-log-encoding-tests", |
| ] |
| } |
| |
| rustc_library("rust") { |
| name = "diagnostics_log_encoding" |
| with_unit_tests = true |
| edition = "2024" |
| |
| deps = [ |
| "//sdk/rust/zx", |
| "//src/lib/diagnostics/log/types", |
| "//third_party/rust_crates:bitfield", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| |
| if (current_build_target_api_level_as_integer <= 26) { |
| deps += [ "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust" ] |
| } else { |
| deps += [ |
| "//sdk/fidl/fuchsia.diagnostics.types:fuchsia.diagnostics.types_rust", |
| ] |
| } |
| |
| visibility = [ |
| "//src/diagnostics/archivist/*", |
| "//src/diagnostics/archivist/tests/integration/realm_factory/puppet:*", |
| "//src/diagnostics/validator/logs/*", |
| "//src/lib/diagnostics/fake-log-sink/rust/*", |
| "//src/lib/diagnostics/log/*", |
| "//src/starnix/kernel/*", |
| ] |
| |
| test_deps = [ "//src/lib/fuchsia" ] |
| |
| sources = [ |
| "src/constants.rs", |
| "src/encode.rs", |
| "src/lib.rs", |
| "src/parse.rs", |
| ] |
| configs += [ "//build/config/rust/lints:clippy_warn_all" ] |
| } |
| |
| fuchsia_unittest_package("diagnostics-log-encoding-tests") { |
| deps = [ ":rust_test" ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| rustc_fuzzer("parse_record_fuzzer") { |
| edition = "2024" |
| deps = [ |
| ":rust", |
| "//src/lib/fuzzing/rust:fuzz", |
| ] |
| source_root = "src/fuzzer.rs" |
| |
| sources = [ "src/fuzzer.rs" ] |
| } |
| |
| fuchsia_fuzzer_component("parse-record-fuzzer-component") { |
| manifest = "meta/parse_record_fuzzer.cml" |
| deps = [ ":parse_record_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_package("diagnostics-log-encoding-fuzzers") { |
| rust_fuzzer_components = [ ":parse-record-fuzzer-component" ] |
| } |