blob: d84d433ba3598d524eb44a7e75cea279248a705c [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("//src/sys/build/components.gni")
executable("fdio-spawn-tests-bin") {
testonly = true
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",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxtest",
]
}
fuchsia_component("fdio-spawn-tests-component") {
testonly = true
manifest = "meta/fdio-spawn-tests-component.cmx"
deps = [ ":fdio-spawn-tests-bin" ]
}
# A test utility used to test various features of fdio_spawn, extensively in spawn_test.cc.
executable("spawn-child-util-bin") {
visibility = [ ":*" ]
output_name = "spawn_child_util"
sources = [ "spawn_child_util.cc" ]
deps = [
"//sdk/lib/fdio",
"//zircon/public/lib/zx",
]
}
fuchsia_component("spawn-child-util-component") {
testonly = true
manifest = "meta/spawn-child-util-component.cmx"
deps = [ ":spawn-child-util-bin" ]
}
# A test utility that attempts to use zx_process_create (mimicking a launcher implementation).
executable("fake-launcher-util-bin") {
visibility = [ ":*" ]
output_name = "fake_launcher_util"
sources = [
"fake_launcher_util.cc",
"fake_launcher_util.h",
]
deps = [
"//sdk/lib/fdio",
"//zircon/public/lib/zx",
]
}
fuchsia_component("fake-launcher-util-component") {
testonly = true
manifest = "meta/fake-launcher-util-component.cmx"
deps = [ ":fake-launcher-util-bin" ]
}
# A simple test utility that returns the integer value provided to it in its first argument.
executable("return-arg-test-util-bin") {
output_name = "return_arg_test_util"
sources = [ "return_arg_util.cc" ]
deps = [ "//src/lib/fxl" ]
}
fuchsia_component("return-arg-test-util-component") {
testonly = true
manifest = "meta/return-arg-test-util-component.cmx"
deps = [ ":return-arg-test-util-bin" ]
}
# A simple program that prints the arguments with newline delimiter.
executable("echo-arguments-bin") {
output_name = "echo_arguments_bin"
sources = [ "echo_arguments.cc" ]
}
fuchsia_component("echo-arguments-bin-component") {
testonly = true
manifest = "meta/echo-arguments-bin-component.cmx"
deps = [ ":echo-arguments-bin" ]
}
# The 'binaries' in the components below are really just text files with either
# a "#!resolve" or "#!" directive.
resource("resolve-once-bin") {
sources = [ "test_bins/resolve_once" ]
outputs = [ "bin/resolve_once" ]
}
fuchsia_component("resolve-once-component") {
testonly = true
manifest = "meta/resolve-once-component.cmx"
deps = [ ":resolve-once-bin" ]
}
resource("resolve-twice-bin") {
sources = [ "test_bins/resolve_twice" ]
outputs = [ "bin/resolve_twice" ]
}
fuchsia_component("resolve-twice-component") {
testonly = true
manifest = "meta/resolve-twice-component.cmx"
deps = [ ":resolve-twice-bin" ]
}
resource("resolve-infinite-loop-bin") {
sources = [ "test_bins/resolve_infinite_loop" ]
outputs = [ "bin/resolve_infinite_loop" ]
}
fuchsia_component("resolve-infinite-loop-component") {
testonly = true
manifest = "meta/resolve-infinite-loop-component.cmx"
deps = [ ":resolve-infinite-loop-bin" ]
}
resource("resolve-to-not-found-bin") {
sources = [ "test_bins/resolve_to_not_found" ]
outputs = [ "bin/resolve_to_not_found" ]
}
fuchsia_component("resolve-to-not-found-component") {
testonly = true
manifest = "meta/resolve-to-not-found-component.cmx"
deps = [ ":resolve-to-not-found-bin" ]
}
resource("shebang-echo-arguments-bin") {
sources = [ "test_bins/shebang_echo_arguments" ]
outputs = [ "bin/shebang_echo_arguments" ]
}
fuchsia_component("shebang-echo-arguments-component") {
testonly = true
manifest = "meta/shebang-echo-arguments-component.cmx"
deps = [ ":shebang-echo-arguments-bin" ]
}
resource("use-script-as-interpreter-bin") {
sources = [ "test_bins/use_script_as_interpreter" ]
outputs = [ "bin/use_script_as_interpreter" ]
}
fuchsia_component("use-script-as-interpreter-component") {
testonly = true
manifest = "meta/use-script-as-interpreter-component.cmx"
deps = [ ":use-script-as-interpreter-bin" ]
}
resource("shebang-infinite-loop-bin") {
sources = [ "test_bins/shebang_infinite_loop" ]
outputs = [ "bin/shebang_infinite_loop" ]
}
fuchsia_component("shebang-infinite-loop-component") {
testonly = true
manifest = "meta/shebang-infinite-loop-component.cmx"
deps = [ ":shebang-infinite-loop-bin" ]
}
resource("attempt-use-shell-outside-package-script") {
sources = [ "test_bins/attempt_use_shell_outside_package.sh" ]
outputs = [ "bin/attempt_use_shell_outside_package.sh" ]
}
fuchsia_component("attempt-use-shell-outside-package-component") {
testonly = true
manifest = "meta/attempt-use-shell-outside-package-component.cmx"
deps = [ ":attempt-use-shell-outside-package-script" ]
}
resource("too-long-shebang-bin") {
sources = [ "test_bins/too_long_shebang" ]
outputs = [ "bin/too_long_shebang" ]
}
fuchsia_component("too-long-shebang-component") {
testonly = true
manifest = "meta/too-long-shebang-component.cmx"
deps = [ ":too-long-shebang-bin" ]
}
resource("use-resolve-from-shebang-bin") {
sources = [ "test_bins/use_resolve_from_shebang" ]
outputs = [ "bin/use_resolve_from_shebang" ]
}
fuchsia_component("use-resolve-from-shebang-component") {
testonly = true
manifest = "meta/use-resolve-from-shebang-component.cmx"
deps = [ ":use-resolve-from-shebang-bin" ]
}
resource("use-shebang-from-resolve-bin") {
sources = [ "test_bins/use_shebang_from_resolve" ]
outputs = [ "bin/use_shebang_from_resolve" ]
}
fuchsia_component("use-shebang-from-resolve-component") {
testonly = true
manifest = "meta/use-shebang-from-resolve-component.cmx"
deps = [ ":use-shebang-from-resolve-bin" ]
}
fuchsia_test_package("fdio-spawn-tests") {
test_components = [ ":fdio-spawn-tests-component" ]
deps = [
":attempt-use-shell-outside-package-component",
":echo-arguments-bin-component",
":fake-launcher-util-component",
":resolve-infinite-loop-component",
":resolve-once-component",
":resolve-to-not-found-component",
":resolve-twice-component",
":return-arg-test-util-component",
":shebang-echo-arguments-component",
":shebang-infinite-loop-component",
":spawn-child-util-component",
":too-long-shebang-component",
":use-resolve-from-shebang-component",
":use-script-as-interpreter-component",
":use-shebang-from-resolve-component",
]
}
group("tests") {
testonly = true
deps = [ ":fdio-spawn-tests" ]
}