|  | # Copyright 2022 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_binary.gni") | 
|  | import("//build/rust/rustc_test.gni") | 
|  | import( | 
|  | "//src/lib/testing/expectation/fuchsia_test_with_expectations_package.gni") | 
|  | import("//src/lib/testing/expectation/generated_expectations_file.gni") | 
|  |  | 
|  | rustc_binary("bin") { | 
|  | edition = "2021" | 
|  | name = "expectation_comparer" | 
|  | with_unit_tests = true | 
|  | deps = [ | 
|  | "expectations_matcher", | 
|  | "ser", | 
|  | "//sdk/fidl/fuchsia.test:fuchsia.test_rust", | 
|  | "//src/lib/fidl/rust/fidl", | 
|  | "//src/lib/fuchsia", | 
|  | "//src/lib/fuchsia-component", | 
|  | "//src/lib/fuchsia-fs", | 
|  | "//third_party/rust_crates:anyhow", | 
|  | "//third_party/rust_crates:futures", | 
|  | "//third_party/rust_crates:itertools", | 
|  | "//third_party/rust_crates:log", | 
|  | "//third_party/rust_crates:serde_json5", | 
|  | ] | 
|  | test_deps = [ | 
|  | "//third_party/rust_crates:assert_matches", | 
|  | "//third_party/rust_crates:glob", | 
|  | "//third_party/rust_crates:test-case", | 
|  | ] | 
|  | sources = [ "src/main.rs" ] | 
|  | configs -= [ "//build/config/rust/lints:allow_unused_results" ] | 
|  | } | 
|  |  | 
|  | rustc_test("example_tests") { | 
|  | edition = "2021" | 
|  | name = "expectation_comparer_example_tests" | 
|  | deps = [ | 
|  | "//src/lib/fuchsia", | 
|  | "//third_party/rust_crates:log", | 
|  | ] | 
|  | source_root = "src/tests.rs" | 
|  | sources = [ "src/tests.rs" ] | 
|  | configs -= [ "//build/config/rust/lints:allow_unused_results" ] | 
|  | } | 
|  |  | 
|  | fuchsia_component("expectation_comparer") { | 
|  | manifest = "meta/expectation_comparer.cml" | 
|  | deps = [ ":bin" ] | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_component("expectation-example-tests") { | 
|  | deps = [ ":example_tests" ] | 
|  | manifest = "meta/test_root.cml" | 
|  | } | 
|  |  | 
|  | fuchsia_test_with_expectations_package("expectation-example-package") { | 
|  | test_components = [ ":expectation-example-tests" ] | 
|  |  | 
|  | test_specs = { | 
|  | log_settings = { | 
|  | max_severity = "ERROR" | 
|  | } | 
|  | } | 
|  | expectations = "example_expectations.json5" | 
|  | } | 
|  |  | 
|  | fuchsia_test_with_expectations_package( | 
|  | "expectation-example-package-just-err-logs-cases") { | 
|  | test_components = [ ":expectation-example-tests" ] | 
|  | treatment_of_cases_with_error_logs = "RUN_ONLY_CASES_WITH_ERROR_LOGS" | 
|  |  | 
|  | test_specs = { | 
|  | log_settings = { | 
|  | max_severity = "ERROR" | 
|  | } | 
|  | } | 
|  | expectations = "example_expectations.json5" | 
|  | } | 
|  |  | 
|  | fuchsia_test_with_expectations_package( | 
|  | "expectation-example-package-no-err-logs-cases") { | 
|  | test_components = [ ":expectation-example-tests" ] | 
|  | treatment_of_cases_with_error_logs = "SKIP_CASES_WITH_ERROR_LOGS" | 
|  | expectations = "example_expectations.json5" | 
|  | } | 
|  |  | 
|  | generated_expectations_file("generated_expectations_example") { | 
|  | includes = [ | 
|  | "example_expectations_part1.json5", | 
|  | "example_expectations_part2.json5", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuchsia_test_with_expectations_package( | 
|  | "expectation-example-package-generated") { | 
|  | test_components = [ ":expectation-example-tests" ] | 
|  |  | 
|  | treatment_of_cases_with_error_logs = "SKIP_CASES_WITH_ERROR_LOGS" | 
|  | generated_expectations = ":generated_expectations_example" | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_package("expectation-unittests") { | 
|  | deps = [ ":bin_test" ] | 
|  | } | 
|  |  | 
|  | group("tests") { | 
|  | testonly = true | 
|  | deps = [ | 
|  | ":expectation-example-package", | 
|  | ":expectation-example-package-generated", | 
|  | ":expectation-example-package-just-err-logs-cases", | 
|  | ":expectation-example-package-no-err-logs-cases", | 
|  | ":expectation-unittests", | 
|  | "preprocess:tests", | 
|  | "ser:tests", | 
|  | "tool:tests", | 
|  | ] | 
|  | } |