blob: 7af608df402ad06789db53500ce9f314d3cfa289 [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.
assert(is_fuchsia, "These targets are only compiled in the fuchsia toolchain.")
import("//build/components.gni")
import("//build/rust/rustc_binary.gni")
group("rust") {
testonly = true
public_deps = [ ":hermetic_tests" ]
}
group("hermetic_tests") {
testonly = true
deps = [ ":rust_logs_example_tests" ]
}
rustc_binary("bin") {
edition = "2021"
output_name = "rust_logs_example"
deps = [
"//src/lib/fuchsia",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:tracing",
]
sources = [ "src/main.rs" ]
}
rustc_test("test") {
edition = "2021"
name = "rust_logs_example_tests"
source_root = "tests/lib.rs"
deps = [
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//src/lib/diagnostics/reader",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/syslog/rust:syslog-listener",
"//third_party/rust_crates:futures",
]
sources = [ "tests/lib.rs" ]
}
fuchsia_component("component") {
component_name = "rust_logs_example"
manifest = "meta/rust_logs_example.cml"
deps = [ ":bin" ]
}
fuchsia_component("test_component") {
testonly = true
component_name = "rust_logs_example_tests"
manifest = "meta/rust_logs_example_tests.cml"
deps = [ ":test" ]
}
# Run with `fx test rust_logs_example_tests`.
fuchsia_test_package("rust_logs_example_tests") {
test_components = [ ":test_component" ]
deps = [ ":component" ]
}