blob: 70fca8e11d675f62e111f62f7babcd69047b0f44 [file] [log] [blame]
# Copyright 2016 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_test.gni")
import("//build/host.gni")
import("//build/test/test_package.gni")
if (current_toolchain == target_toolchain) {
_go_root = "$host_tools_dir/goroot"
compiled_action("makeroot") {
visibility = [ ":makefuchsia" ]
depfile = "$target_gen_dir/$target_name.d"
outputs = [ "$target_gen_dir/$target_name.stamp" ]
tool = "makeroot"
args = [
"-source-goroot",
rebase_path(".", root_build_dir),
"-target-goroot",
rebase_path(_go_root, root_build_dir),
"-depfile",
rebase_path(depfile, root_build_dir),
"-stamp-file",
rebase_path(outputs[0], root_build_dir),
]
}
compiled_action("makefuchsia") {
visibility = [ ":go_runtime" ]
deps = [ ":makeroot" ]
depfile = "$target_gen_dir/$target_name.d"
outputs = [ "$target_gen_dir/$target_name.stamp" ]
tool = "makefuchsia"
args = [
"-bootstrap-goroot",
rebase_path("//prebuilt/third_party/go/${host_platform}"),
"-gocache",
gocache_dir,
"-goroot",
rebase_path(_go_root, root_build_dir),
"-depfile",
rebase_path(depfile, root_build_dir),
"-stamp-file",
rebase_path(outputs[0], root_build_dir),
]
}
}
group("go_runtime") {
public_deps = [ ":makefuchsia(${target_toolchain})" ]
}
go_test("go_dispatch_test") {
gopackages = [ "syscall/zx/dispatch" ]
}
go_test("go_exec_test") {
gopackages = [ "os/exec" ]
}
go_test("go_net_test") {
gopackages = [ "net" ]
}
go_test("go_os_test") {
gopackages = [ "os" ]
}
go_test("go_pprof_test") {
gopackages = [ "runtime/pprof" ]
}
go_test("go_zxwait_test") {
gopackages = [ "syscall/zx/zxwait" ]
}
group("exec_test_deps") {
deps = [
"//third_party/sbase:cat",
"//third_party/sbase:echo",
]
}
test_package("go_stdlib_tests") {
deps = [
":exec_test_deps",
":go_dispatch_test",
":go_exec_test",
":go_net_test",
":go_os_test",
":go_pprof_test",
":go_zxwait_test",
]
tests = [
{
name = "go_dispatch_test"
environments = [ qemu_env ]
},
{
name = "go_exec_test"
environments = [ qemu_env ]
},
{
name = "go_net_test"
environments = [ qemu_env ]
},
{
name = "go_os_test"
environments = [ qemu_env ]
},
{
name = "go_pprof_test"
environments = [ qemu_env ]
# TODO(47563): deflake and re-enable.
disabled = true
},
{
name = "go_zxwait_test"
environments = [ qemu_env ]
},
]
}
go_test("go_fidl_test") {
gopackages = [ "syscall/zx/fidl" ]
}
go_test("go_extended_fidl_test") {
# N.B. these tests are not in the fidl package to avoid having to rebuild the
# go toolchain while iterating on them.
gopackages = [ "syscall/zx/fidl/fidl_test" ]
# TODO(pascallouis): Currently, while we take a dependency, the output of
# this FIDL rule is not directly used, rather the generated bindings were
# copied and checked in.
#
# Not being able to depend on automated generation is due to where code is
# placed, and how this relates to the tree structure of the toolchain.
# Disabling while fidlgen table generation is pending.
# Use regen-fidl to generate this file.
# deps = [
# "src/syscall/zx/fidl/bindingstest($go_toolchain)",
# ]
}
test_package("go_fidl_tests") {
deps = [
":go_extended_fidl_test",
":go_fidl_test",
]
tests = [
{
name = "go_fidl_test"
environments = [ qemu_env ]
},
{
name = "go_extended_fidl_test"
environments = [ qemu_env ]
},
]
}