| # 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/config.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") { |
| testonly = true |
| name = "config_validation_test" |
| deps = [ |
| "//src/diagnostics/lib/sampler-config", |
| "//src/diagnostics/sampler:lib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| ] |
| |
| 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") { |
| testonly = true |
| name = "sampler_integration_test" |
| deps = [ |
| "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt-rustc", |
| "//sdk/fidl/fuchsia.cobalt.test:fuchsia.cobalt.test-rustc", |
| "//sdk/fidl/fuchsia.component:fuchsia.component-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol-rustc", |
| "//sdk/fidl/fuchsia.io2:fuchsia.io2-rustc", |
| "//src/diagnostics/sampler/tests/fidl:fuchsia.mockrebootcontroller-rustc", |
| "//src/diagnostics/sampler/tests/fidl:fuchsia.samplertestcontroller-rustc", |
| "//src/lib/diagnostics/reader/rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-component-test", |
| "//src/sys/lib/cm_rust", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| source_root = "lib.rs" |
| |
| sources = [ |
| "lib.rs", |
| "mocks.rs", |
| "test_topology.rs", |
| "utils.rs", |
| ] |
| } |
| |
| # Sampler component with a frequent sample rate for testing |
| fuchsia_component("sampler-for-test") { |
| testonly = true |
| manifest = "meta/sampler-for-test.cml" |
| deps = [ "//src/diagnostics/launcher:bin" ] |
| } |
| |
| fuchsia_unittest_component("sampler-integration-test") { |
| manifest = "meta/integration-test.cml" |
| deps = [ ":integration-bin" ] |
| } |
| |
| # config-data sampler config that requires reboot |
| # for the integration test. |
| config_data("reboot-required-config") { |
| for_pkg = "sampler-integration-tests" |
| sources = [ "configs/reboot_required_config.json" ] |
| outputs = [ "metrics/reboot_required_config.json" ] |
| } |
| |
| # Config-data for the integration test. |
| config_data("test-config") { |
| for_pkg = "sampler-integration-tests" |
| sources = [ "configs/test_config.json" ] |
| outputs = [ "metrics/test_config.json" ] |
| } |
| |
| resource("validation-resources") { |
| sources = [ |
| "configs/reboot_required_config.json", |
| "configs/test_config.json", |
| ] |
| outputs = [ "config/metrics/{{source_file_part}}" ] |
| } |
| |
| fuchsia_test_package("sampler-integration-tests") { |
| test_components = [ |
| ":config-validation-test", |
| ":sampler-integration-test", |
| ] |
| deps = [ |
| ":reboot-required-config", |
| ":sampler-for-test", |
| ":test-config", |
| ":validation-resources", |
| "//src/diagnostics/sampler/tests/test_component:single_counter_test_component", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":sampler-integration-tests" ] |
| } |