| # 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") | |
| group("tests") { | |
| testonly = true | |
| deps = [] | |
| if (host_os == "linux") { | |
| deps += [ ":limited_netsvc_tests($host_toolchain)" ] | |
| } | |
| } | |
| if (is_linux) { | |
| go_library("lib") { | |
| testonly = true | |
| deps = [ "//src/testing/emulator" ] | |
| sources = [ "limited_netsvc_test.go" ] | |
| } | |
| host_test_data("main_zbi") { | |
| sources = [ "$root_build_dir/fuchsia.zbi" ] | |
| } | |
| net_tools = [ | |
| "netaddr", | |
| "netcp", | |
| "netls", | |
| "netruncmd", | |
| ] | |
| # Recompute the value of host_out_dir when is_host is true. That is because host_toolchain | |
| # always include a variant suffix in this case (e.g. 'host_x64-asan'), while host_out_dir | |
| # will always correspond to the base host toolchain output directory. | |
| if (is_host) { | |
| host_out_dir = get_label_info("//anything($host_toolchain)", "root_out_dir") | |
| } | |
| host_test_data("copy_netsvc_tools") { | |
| visibility = [ ":*" ] | |
| sources = [] | |
| outputs = [ "$root_out_dir/test_data/limited_netsvc/{{source_file_part}}" ] | |
| deps = [] | |
| foreach(tool, net_tools) { | |
| sources += [ "$host_out_dir/$tool" ] | |
| deps += [ "//tools/netprotocol:$tool($host_toolchain)" ] | |
| } | |
| } | |
| host_test_data("copy_loglistener") { | |
| visibility = [ ":*" ] | |
| sources = [ "$host_out_dir/loglistener" ] | |
| outputs = [ "$root_out_dir/test_data/limited_netsvc/loglistener" ] | |
| deps = [ "//tools/loglistener($host_toolchain)" ] | |
| } | |
| group("netsvc_user_tools") { | |
| testonly = true | |
| deps = [ | |
| ":copy_loglistener", | |
| ":copy_netsvc_tools", | |
| ] | |
| } | |
| # TODO(scottmg): Colocate this test with netsvc when it moves out of //zircon. | |
| go_test("limited_netsvc_tests") { | |
| gopackages = [ "go.fuchsia.dev/fuchsia/src/tests/limited_netsvc" ] | |
| deps = [ | |
| ":lib", | |
| "//tools/net/netutil", | |
| "//tools/net/tftp", | |
| ] | |
| non_go_deps = [ | |
| ":main_zbi", | |
| ":netsvc_user_tools", | |
| ] | |
| } | |
| } |