| # 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/components.gni") |
| import("//build/config/clang/clang.gni") |
| import("//build/config/sysroot.gni") |
| import("//build/go/go_test.gni") |
| import("//build/host.gni") |
| |
| if (is_host && current_toolchain == toolchain_variant.base) { |
| _go_root = "$host_tools_dir/goroot" |
| |
| compiled_action("makeroot") { |
| visibility = [ ":makefuchsia" ] |
| |
| depfile = "$target_gen_dir/$target_name.d" |
| inputs = [ |
| ".git/HEAD", |
| ".git/index", |
| ".gitignore", |
| ] |
| _output = "$target_gen_dir/$target_name.stamp" |
| outputs = [ _output ] |
| |
| 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(_output, root_build_dir), |
| ] |
| } |
| |
| compiled_action("makefuchsia") { |
| visibility = [ ":go_runtime" ] |
| deps = [ ":makeroot" ] |
| |
| depfile = "$target_gen_dir/$target_name.d" |
| _output = "$target_gen_dir/$target_name.stamp" |
| outputs = [ _output ] |
| |
| tool = "makefuchsia" |
| args = [ |
| "--cc", |
| rebase_path("${clang_prefix}/clang", root_build_dir), |
| "--cxx", |
| rebase_path("${clang_prefix}/clang++", root_build_dir), |
| "--gocache", |
| rebase_path(gocache_dir, root_build_dir), |
| "--goroot", |
| rebase_path(_go_root, root_build_dir), |
| "--goroot-bootstrap", |
| rebase_path("//prebuilt/third_party/go/${host_platform}", root_build_dir), |
| "--sysroot", |
| rebase_path(sysroot, root_build_dir), |
| |
| "--depfile", |
| rebase_path(depfile, root_build_dir), |
| "--stamp-file", |
| rebase_path(_output, root_build_dir), |
| ] |
| } |
| } |
| |
| group("go_runtime") { |
| if (is_host) { |
| public_deps = [ ":makefuchsia(${toolchain_variant.base})" ] |
| } else { |
| public_deps = [ ":$target_name(${host_toolchain})" ] |
| } |
| } |
| |
| 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_zx_test") { |
| gopackages = [ "syscall/zx" ] |
| } |
| |
| go_test("go_zxwait_test") { |
| gopackages = [ "syscall/zx/zxwait" ] |
| } |
| |
| fuchsia_component("go-exec-test") { |
| testonly = true |
| manifest = "meta/go_exec_test.cml" |
| deps = [ |
| ":go_exec_test", |
| "//third_party/sbase:cat", |
| "//third_party/sbase:echo", |
| ] |
| } |
| |
| fuchsia_component("go-net-test") { |
| testonly = true |
| manifest = "meta/go_net_test.cml" |
| deps = [ ":go_net_test" ] |
| } |
| |
| fuchsia_component("go-os-test") { |
| testonly = true |
| manifest = "meta/go_os_test.cml" |
| deps = [ ":go_os_test" ] |
| } |
| |
| fuchsia_component("go-pprof-test") { |
| testonly = true |
| manifest = "meta/go_pprof_test.cml" |
| deps = [ ":go_pprof_test" ] |
| } |
| |
| fuchsia_component("go-zx-test") { |
| testonly = true |
| manifest = "meta/go_zx_test.cml" |
| deps = [ ":go_zx_test" ] |
| } |
| |
| fuchsia_component("go-zxwait-test") { |
| testonly = true |
| manifest = "meta/go_zxwait_test.cml" |
| deps = [ ":go_zxwait_test" ] |
| } |
| |
| fuchsia_test_package("go-stdlib-tests") { |
| test_components = [ |
| ":go-exec-test", |
| ":go-net-test", |
| ":go-os-test", |
| ":go-pprof-test", |
| ":go-zx-test", |
| ":go-zxwait-test", |
| ] |
| |
| deps = [ |
| "//src/connectivity/network/netstack:component", |
| "//src/storage/testing:storage_driver_test_realm", |
| ] |
| |
| test_specs = { |
| environments = [ emu_env ] |
| } |
| } |
| |
| go_test("go_unsafevalue_test") { |
| gopackages = [ "syscall/zx/fidl/internal/unsafevalue" ] |
| |
| # This runs both on target device and as a host test. |
| # In both cases, it needs to build a go toolchain rather than using a prebuilt because |
| # it is testing the fidl package, which is implemented in the toolcahin itself. |
| use_prebuilt_go = false |
| } |
| |
| 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/internal/bindingstest($go_toolchain)", |
| # ] |
| } |
| |
| fuchsia_component("go-unsafevalue-test") { |
| testonly = true |
| manifest = "meta/go_unsafevalue_test.cml" |
| deps = [ ":go_unsafevalue_test" ] |
| } |
| |
| fuchsia_component("go-fidl-test") { |
| testonly = true |
| manifest = "meta/go_fidl_test.cml" |
| deps = [ ":go_fidl_test" ] |
| } |
| |
| fuchsia_component("go-extended-fidl-test") { |
| testonly = true |
| manifest = "meta/go_extended_fidl_test.cml" |
| deps = [ ":go_extended_fidl_test" ] |
| } |
| |
| fuchsia_test_package("go-fidl-tests") { |
| test_components = [ |
| ":go-unsafevalue-test", |
| ":go-extended-fidl-test", |
| ":go-fidl-test", |
| ] |
| |
| test_specs = { |
| environments = [ emu_env ] |
| } |
| } |
| |
| group("fidl-tests") { |
| testonly = true |
| deps = [ |
| ":go-fidl-tests", |
| ":go_extended_fidl_test($host_toolchain)", |
| ":go_unsafevalue_test($host_toolchain)", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fidl-tests", |
| ":go-stdlib-tests", |
| ] |
| } |