blob: f7d7a7993b43f3297586976f20bc6f1d898e4760 [file] [log] [blame]
# Copyright 2019 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("testsharder_lib") {
sources = [
"doc.go",
"durations.go",
"durations_test.go",
"images.go",
"images_test.go",
"postprocess.go",
"postprocess_test.go",
"preprocess.go",
"preprocess_test.go",
"shard.go",
"shard_test.go",
"test.go",
"test_modifier.go",
"test_modifier_test.go",
]
deps = [
"//src/sys/pkg/bin/pm:pm_lib",
"//tools/build",
"//tools/lib/color",
"//tools/lib/logger",
"//tools/testing/runtests",
]
}
go_library("main") {
source_dir = "cmd"
sources = [
"main.go",
"main_test.go",
]
deps = [
":testsharder_lib",
"//tools/lib/flagmisc",
]
}
go_binary("testsharder") {
gopackage = "go.fuchsia.dev/fuchsia/tools/integration/testsharder/cmd"
deps = [ ":main" ]
}
if (is_host) {
go_test("testsharder_lib_tests") {
gopackages = [ "go.fuchsia.dev/fuchsia/tools/integration/testsharder" ]
deps = [
":testsharder_lib",
"//third_party/golibs:github.com/google/go-cmp",
]
}
# TODO(olivernewman): Consider running the test executable locally to generate
# a depfile so it's not necessary to copy-paste these names.
_golden_tests = [
"affected nonhermetic tests",
"affected tests",
"hermetic deps",
"max shards per env",
"mixed device types",
"multiply",
"multiply affected test",
"multiply unaffected hermetic tests",
"sharding by time",
"skip unaffected tests",
"target test count",
"test list with tags",
]
_golden_dir = "${target_gen_dir}/goldens"
host_test_data("copy_golden_files") {
sources = []
foreach(test_name, _golden_tests) {
_file_name = string_replace(test_name, " ", "_")
sources += [ "cmd/testdata/${_file_name}.golden.json" ]
}
outputs = [ "${_golden_dir}/{{source_file_part}}" ]
}
go_test("testsharder_tests") {
gopackages = [ "go.fuchsia.dev/fuchsia/tools/integration/testsharder/cmd" ]
deps = [
":main",
"//third_party/golibs:github.com/google/go-cmp",
"//tools/lib/jsonutil",
]
non_go_deps = [ ":copy_golden_files" ]
args = [
"-goldens-dir",
rebase_path(_golden_dir, root_build_dir),
]
}
}
group("tests") {
testonly = true
deps = [
":testsharder_lib_tests($host_toolchain)",
":testsharder_tests($host_toolchain)",
]
}