blob: 6818219d970b63a8248f0f12a6aa0d2a41342736 [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("//build/package.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
test("shell_tests_bin") {
deps = [
"//sdk/lib/fidl/cpp/test",
"//src/developer/shell/console:tests",
"//src/developer/shell/lib:tests",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gtest",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
]
# Extra stack needed to avoid crashes when calling QuickJS functions
# with asan enabled.
ldflags = [ "-Wl,-z,stack-size=0x200000" ]
}
# Generate a manifest providing all of the .fidl.json files exported by the
# core SDK (and any other FIDL files we might want).
action("generate_fidl_json") {
script = "generate_fidl_json.sh"
generated_output = "$target_gen_dir/sdk_fidl_json.manifest"
outputs = [
"$generated_output",
]
testonly = true
deps = [
"//garnet/examples/fidl/services:echo",
"//sdk:core",
"//sdk:core_fidl_json",
"//sdk/fidl/fuchsia.power:fuchsia.power",
"//third_party/quickjs:qjs($host_toolchain)",
"//zircon/system/fidl/fuchsia-device-manager",
"//zircon/system/fidl/fuchsia-kernel",
]
args = [
"--qjs=" + rebase_path("$root_build_dir/host_$host_cpu/qjs"),
"--fidl-json-file=" +
rebase_path("$root_gen_dir/sdk/core.fidl_json.txt", root_build_dir),
"--out-file=" + rebase_path("$generated_output", root_build_dir),
rebase_path(
"$root_build_dir/fidling/gen/garnet/examples/fidl/services/echo.fidl.json",
root_build_dir),
rebase_path(
"$root_build_dir/fidling/gen/sdk/fidl/fuchsia.power/fuchsia.power.fidl.json",
root_build_dir),
rebase_path(
"$root_build_dir/fidling/gen/zircon/system/fidl/fuchsia-kernel/fuchsia-kernel.fidl.json",
root_build_dir),
rebase_path(
"$root_build_dir/fidling/gen/zircon/system/fidl/fuchsia-device-manager/fuchsia-device-manager.fidl.json",
root_build_dir),
rebase_path(
"$root_build_dir/fidling/gen/zircon/system/fidl/fuchsia-boot/fuchsia-boot.fidl.json",
root_build_dir),
]
}
test_package("shell_tests") {
rootjob_svc = "//build"
deps = [
":generate_fidl_json",
":shell_tests_bin",
"//src/developer/shell/lib:js_libs",
"//src/developer/shell/lib:spawn_child_test_util",
]
binaries = [
{
name = "spawn_child_test_util"
},
]
tests = [
{
name = "shell_tests_bin"
environments = basic_envs
},
]
extra = get_target_outputs(":generate_fidl_json") +
[ "$target_gen_dir/lib/libs.manifest" ]
}
group("tests") {
testonly = true
deps = [
":shell_tests",
]
}
executable("bin") {
output_name = "josh"
sources = [
"main.cc",
]
deps = [
"//src/developer/shell/console",
"//src/developer/shell/lib",
]
libs = [ "zircon" ]
# Extra stack needed to avoid crashes when calling QuickJS functions
# with asan enabled.
ldflags = [ "-Wl,-z,stack-size=0x200000" ]
}
# "josh" is Javascript Object SHell. We can change the name later.
package("josh") {
# TODO(jeremymanson): This is only testonly because sdk:core is. We should undo that.
testonly = true
deps = [
":bin",
":generate_fidl_json",
"//src/developer/shell/lib:js_libs",
]
binaries = [
{
name = "josh"
shell = true
},
]
extra = get_target_outputs(":generate_fidl_json") +
[ "$target_gen_dir/lib/libs.manifest" ]
}