blob: 56fe0aca368416e07192e2f65dfe5525cbcdcfa5 [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",
]
}
group("tests") {
testonly = true
deps = [
":triage_lib_test($host_toolchain)",
"build/triage_config_test_runner:tests",
"test_data",
"//src/diagnostics/lib/triage:unittests($host_toolchain)",
]
}
# 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/error_rate.triage",
"test_data/config/other.triage",
"test_data/config/sample.triage",
"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_bugreport") {
testonly = true
sources = [ "test_data/bugreport/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/bugreport/{{source_file_part}}" ]
}
# Needed to generate the runtime deps file which is used in CQ for sandboxing
group("test_data") {
testonly = true
deps = [
":copy_bugreport",
":copy_configs",
]
# Need to indicate our dependencies for host side integration testing
runtime_deps =
get_target_outputs(":copy_bugreport") +
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_lib") {
edition = 2018
deps = lib_deps
}
rustc_test("triage_lib_test") {
edition = 2018
deps = lib_deps + [
":triage_lib",
# we need to take a dependency on our bin because our integration tests invoke it
":triage_bin",
":test_data",
]
}
rustc_binary("triage_bin") {
name = "triage"
edition = "2018"
deps = lib_deps + [ ":triage_lib" ]
}
install_host_tools("install") {
deps = [ ":triage_bin" ]
outputs = [ "triage" ]
}