| # 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/rust/rustc_library.gni") |
| |
| # Test binary responsible for readings |
| # and validating all client configurations |
| # listed in the "production sampler" sampler_configuration. |
| rustc_test("config-validation") { |
| edition = "2021" |
| testonly = true |
| name = "config_validation_test" |
| deps = [ |
| "//src/diagnostics/lib/sampler-config", |
| "//src/lib/fuchsia", |
| ] |
| |
| source_root = "config_validation.rs" |
| sources = [ "config_validation.rs" ] |
| } |
| |
| # Test component for config validation. |
| fuchsia_unittest_component("config-validation-test") { |
| deps = [ ":config-validation" ] |
| } |
| |
| # Integration test binary for sampler service. |
| rustc_test("integration-bin") { |
| edition = "2021" |
| testonly = true |
| name = "sampler_integration_test" |
| deps = [ |
| "../testing/fidl:test.sampler_rust", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.metrics.test:fuchsia.metrics.test_rust", |
| "//src/diagnostics/sampler/tests/fidl:fuchsia.mockrebootcontroller_rust", |
| "//src/diagnostics/sampler/tests/fidl:fuchsia.samplertestcontroller_rust", |
| "//src/lib/diagnostics/reader/rust", |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/testing/realm_client/rust", |
| "//third_party/rust_crates:anyhow", |
| ] |
| |
| source_root = "lib.rs" |
| |
| sources = [ |
| "lib.rs", |
| "test_topology.rs", |
| "utils.rs", |
| ] |
| } |
| |
| fuchsia_component("sampler-test-suite-component") { |
| testonly = true |
| component_name = "sampler-test-suite" |
| manifest = "meta/integration-test.cml" |
| deps = [ ":integration-bin" ] |
| } |
| |
| fuchsia_package("sampler-test-suite") { |
| testonly = true |
| deps = [ ":sampler-test-suite-component" ] |
| } |
| |
| fuchsia_structured_config_values("sampler-test-config") { |
| values_source = "component_configs/integration-test.json5" |
| component_name = "sampler" |
| cm_label = "//src/diagnostics/sampler:sampler-manifest" |
| } |
| |
| resource("validation-sampler-resources") { |
| sources = [ |
| "configs/reboot_required_config.json", |
| "configs/test_config.json", |
| ] |
| outputs = [ "data/config/metrics/any_name/{{source_file_part}}" ] |
| } |
| |
| resource("validation-fire-components") { |
| sources = [ "configs/components.json5" ] |
| outputs = [ "data/config/fire/any_name/{{source_file_part}}" ] |
| } |
| |
| resource("validation-fire-projects") { |
| sources = [ |
| "configs/fire_1.json5", |
| "configs/fire_2.json5", |
| "configs/fire_3.json5", |
| ] |
| outputs = [ "data/config/fire/any_name/projects/{{source_file_part}}" ] |
| } |
| |
| fuchsia_component("sampler-test-root") { |
| testonly = true |
| manifest = "meta/test-root.cml" |
| } |
| |
| fuchsia_test_package("sampler-integration-tests") { |
| test_components = [ |
| ":config-validation-test", |
| ":sampler-test-root", |
| ] |
| subpackages = [ |
| "../testing/realm-factory", |
| ":sampler-test-suite", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":sampler-integration-tests" ] |
| } |