blob: 0c4c2363056c8442a5c60d7929f86f4ef92a208a [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_library.gni")
import("//build/go/go_test.gni")
import("//build/testing/host_test_data.gni")
test_dirs = []
if (host_os == "linux") {
# Each of these tests runs against a QEMU instance, but on ASAN builds it
# takes a very long time to bring up QEMU (>1 minute), which means we can
# easily exceed the global test timeout if we try to run multiple tests in
# the same test target.
#
# Instead, shard each test into its own target so it has enough time to
# spin up QEMU, run the test, and bring it back down.
#
# If this becomes problematic it's possible to put multiple tests in a file,
# but this makes them more brittle and tricky to write since the QEMU
# instance is now shared state that carries over between tests.
test_dirs += [
"test_advert_frequency",
"test_init_partition_tables",
"test_pave_no_bind",
"test_pave_no_bind_failure",
"test_write_firmware_no_type",
"test_write_firmware_with_type",
]
}
group("tests") {
testonly = true
deps = []
foreach(test_dir, test_dirs) {
deps += [ ":bootserver_${test_dir}($host_toolchain)" ]
}
}
if (is_linux) {
go_library("lib") {
testonly = true
deps = [
"//tools/emulator/emulatortest",
"//tools/net/netutil",
"//tools/net/tftp",
]
non_go_deps = [
":bootserver_user_tools",
"//build/images/fuchsia:fuchsia_zbi_for_host_tests",
]
sources = [ "common.go" ]
}
foreach(test_dir, test_dirs) {
_test = "bootserver_${test_dir}"
_library = "${_test}_lib"
go_library(_library) {
source_dir = test_dir
testonly = true
deps = [ ":lib" ]
sources = [ "${test_dir}_test.go" ]
}
go_test(_test) {
library = ":${_library}"
args = [
"--test_data_dir",
rebase_path("$root_out_dir/test_data", root_build_dir),
]
}
}
host_out_dir = get_label_info("//bogus($host_toolchain)", "root_out_dir")
host_test_data("copy_bootserver") {
visibility = [ ":*" ]
sources = [ "$host_out_dir/bootserver" ]
outputs = [ "$root_out_dir/test_data/bootserver_tools/bootserver" ]
deps = [ "//tools/bootserver_old:bootserver($host_toolchain)" ]
}
host_test_data("copy_netls") {
visibility = [ ":*" ]
sources = [ "$host_out_dir/netls" ]
outputs = [ "$root_out_dir/test_data/bootserver_tools/netls" ]
deps = [ "//tools/netprotocol:netls($host_toolchain)" ]
}
host_test_data("copy_fake_firmware") {
visibility = [ ":*" ]
sources = [ "testdata/fake_firmware" ]
outputs = [ "$root_out_dir/test_data/bootserver_tools/fake_firmware" ]
}
group("bootserver_user_tools") {
testonly = true
deps = [
":copy_bootserver",
":copy_fake_firmware",
":copy_netls",
]
}
}