blob: 8c5d6a8cf17de33eb2be67f30041f29a6d4c8658 [file] [log] [blame]
# Copyright 2018 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/host.gni")
import("//build/package.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//build/rust/rustc_test.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
group("triage") {
testonly = true
deps = [
":tests",
":triage_bin",
]
}
# Note: This does not pick up all triage tests - there are tests in
# //src/diagnostics/lib/triage and //src/diagnostics/config/triage.
# Use --with //src/diagnostics:tests, not --with //src/diagnostics/triage:tests.
group("tests") {
testonly = true
deps = [
":triage_lib_test($host_toolchain)",
"build/triage_config_test_runner:tests",
"test_data",
]
}
# Needed for testing on host
copy("copy_configs") {
testonly = true
# Any data that is needed for a test should be included in this list.
sources = [
"test_data/config/annotation_tests.triage",
"test_data/config/error_rate.triage",
"test_data/config/log_tests.triage",
"test_data/config/map_fold.triage",
"test_data/config/other.triage",
"test_data/config/sample.triage",
"test_data/config/sample_bundle.json",
"test_data/config/sample_bundle_file_type_error.json",
"test_data/config/sample_bundle_files_error.json",
"test_data/config/sample_tags.triage",
]
# If this path changes then the integration.rs file needs to be udpated
# to look in the correct place.
outputs = [ "$root_out_dir/test_data/triage/config/{{source_file_part}}" ]
}
# Needed for testing on host
copy("copy_snapshot") {
testonly = true
sources = [
"test_data/snapshot/annotations.json",
"test_data/snapshot/inspect.json",
]
# If this path changes then the integration.rs file needs to be udpated
# to look in the correct place.
outputs = [ "$root_out_dir/test_data/triage/snapshot/{{source_file_part}}" ]
}
# Needed to generate the runtime deps file which is used in CQ for sandboxing
group("test_data") {
testonly = true
deps = [
":copy_configs",
":copy_snapshot",
]
# Need to indicate our dependencies for host side integration testing
runtime_deps =
get_target_outputs(":copy_snapshot") +
get_target_outputs(":copy_configs") + [ "${root_out_dir}/triage" ]
metadata = {
test_runtime_deps = runtime_deps
}
}
lib_deps = [
"//src/diagnostics/lib/triage",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:log",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_derive",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:structopt",
]
rustc_library("triage_app_lib") {
edition = 2018
deps = lib_deps
sources = [
"src/app.rs",
"src/config.rs",
"src/file_io.rs",
"src/lib.rs",
]
}
rustc_test("triage_lib_test") {
edition = 2018
deps = lib_deps + [
":triage_app_lib",
# we need to take a dependency on our bin because our integration tests invoke it
":triage_bin",
":test_data",
]
sources = [
"src/app.rs",
"src/config.rs",
"src/file_io.rs",
"src/lib.rs",
"src/test.rs",
"src/test/integration.rs",
]
}
rustc_binary("triage_bin") {
name = "triage"
edition = "2018"
deps = lib_deps + [ ":triage_app_lib" ]
sources = [ "src/main.rs" ]
}
install_host_tools("install") {
deps = [ ":triage_bin" ]
outputs = [ "triage" ]
}