blob: c07b58af6d8999fe4c732b26f96af9bfd6b9e93d [file] [log] [blame]
# Copyright 2020 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/go/go_binary.gni")
import("//build/go/go_library.gni")
import("//build/go/go_test.gni")
import("//build/testing/host_test_data.gni")
go_library("lib") {
sources = [
"client.go",
"client_test.go",
"lib.go",
"lib_test.go",
]
deps = [
"//third_party/golibs:golang.org/x/sync",
"//third_party/golibs:google.golang.org/protobuf",
"//third_party/luci-go/resultdb/proto/v1:resultdb_proto_go",
"//third_party/luci-go/resultdb/sink/proto/v1:resultsink_proto_go",
"//tools/build",
"//tools/lib/flagmisc",
"//tools/testing/runtests",
]
}
go_library("main") {
source_dir = "cmd"
sources = [
"main.go",
"main_test.go",
]
deps = [
":lib",
"//third_party/golibs:github.com/google/go-cmp",
"//third_party/golibs:golang.org/x/sync",
"//third_party/golibs:google.golang.org/protobuf",
"//third_party/luci-go/resultdb/proto/v1:resultdb_proto_go",
"//third_party/luci-go/resultdb/sink/proto/v1:resultsink_proto_go",
"//tools/lib/flagmisc",
"//tools/testing/runtests",
"//tools/testing/testparser",
]
}
go_binary("resultdb") {
library = ":main"
# Needed to support cross-compilation. The infra recipes always needs this
# built for Linux, even if build happens on Mac.
cgo = false
}
group("tests") {
testonly = true
deps = [
":resultdb_lib_tests($host_toolchain)",
":test($host_toolchain)",
]
}
if (is_host) {
_testdata_path = "$target_gen_dir/testdata"
go_test("test") {
library = ":main"
output_name = "resultdb_tests"
}
host_test_data("testdata") {
sources = [
"testdata/lucictx.json",
"testdata/serial_log.txt",
"testdata/summary.json",
"testdata/summary2.json",
"testdata/summary_long_name.json",
"testdata/syslog.txt",
"testdata/test_output.txt",
]
outputs = [ "${_testdata_path}/{{source_file_part}}" ]
}
go_test("resultdb_lib_tests") {
library = ":lib"
args = [
"--test_data_dir",
rebase_path(_testdata_path, root_build_dir),
]
non_go_deps = [ ":testdata" ]
}
}