| # 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/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| executable("bin") { |
| testonly = true |
| output_name = "fdio_spawn_tests" |
| visibility = [ ":*" ] |
| |
| sources = [ |
| "fake_launcher_util.h", |
| "resolve_test.cc", |
| "shebang_test.cc", |
| "spawn_test.cc", |
| "util.cc", |
| "util.h", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| # A test utility used to test various features of fdio_spawn, extensively in spawn_test.cc. |
| executable("spawn_child_util") { |
| testonly = true |
| visibility = [ ":*" ] |
| |
| sources = [ "spawn_child_util.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| # A test utility that attempts to use zx_process_create (mimicking a launcher implementation). |
| executable("fake_launcher_util") { |
| testonly = true |
| visibility = [ ":*" ] |
| |
| sources = [ |
| "fake_launcher_util.cc", |
| "fake_launcher_util.h", |
| ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| # A simple test utility that returns the integer value provided to it in its first argument. |
| executable("return_arg_test_util") { |
| testonly = true |
| |
| sources = [ "return_arg_util.cc" ] |
| |
| deps = [ "//src/lib/fxl" ] |
| } |
| |
| test_package("fdio_spawn_tests") { |
| deps = [ |
| ":bin", |
| ":fake_launcher_util", |
| ":return_arg_test_util", |
| ":spawn_child_util", |
| "//zircon/third_party/uapp/dash", |
| ] |
| |
| binaries = [ |
| { |
| name = "fake_launcher_util" |
| }, |
| { |
| name = "return_arg_test_util" |
| }, |
| { |
| name = "sh" |
| }, |
| { |
| name = "spawn_child_util" |
| }, |
| |
| # These 'binaries' (really just text files with either a "#!resolve" or "#!" directive) are |
| # copied straight out of the source directory into bin/ in the package, but the package template |
| # expects the source path to be relative to root_build_dir, so we first rebase to that. |
| { |
| name = "resolve_once" |
| source = rebase_path("test_bins/resolve_once", root_build_dir) |
| }, |
| { |
| name = "resolve_twice" |
| source = rebase_path("test_bins/resolve_twice", root_build_dir) |
| }, |
| { |
| name = "resolve_infinite_loop" |
| source = rebase_path("test_bins/resolve_infinite_loop", root_build_dir) |
| }, |
| { |
| name = "resolve_to_not_found" |
| source = rebase_path("test_bins/resolve_to_not_found", root_build_dir) |
| }, |
| { |
| name = "echo_arguments.sh" |
| source = rebase_path("test_bins/echo_arguments.sh", root_build_dir) |
| }, |
| { |
| name = "use_script_as_interpreter" |
| source = |
| rebase_path("test_bins/use_script_as_interpreter", root_build_dir) |
| }, |
| { |
| name = "shebang_infinite_loop" |
| source = rebase_path("test_bins/shebang_infinite_loop", root_build_dir) |
| }, |
| { |
| name = "attempt_use_shell_outside_package.sh" |
| source = rebase_path("test_bins/attempt_use_shell_outside_package.sh", |
| root_build_dir) |
| }, |
| { |
| name = "too_long_shebang" |
| source = rebase_path("test_bins/too_long_shebang", root_build_dir) |
| }, |
| { |
| name = "use_resolve_from_shebang" |
| source = rebase_path("test_bins/use_resolve_from_shebang", root_build_dir) |
| }, |
| { |
| name = "use_shebang_from_resolve" |
| source = rebase_path("test_bins/use_shebang_from_resolve", root_build_dir) |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "fdio_spawn_tests" |
| environments = basic_envs |
| }, |
| ] |
| } |