blob: f1d059ba8b179fccc36a40901aee66de4254fe56 [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
import("//build/components.gni")
import("//build/test.gni")
import("//build/testing/environments.gni")
import("//build/testing/host_test_data.gni")
group("tests") {
testonly = true
deps = [
":devicetree-extract-package",
":devicetree-test-package",
":devicetree-tests($host_toolchain)",
]
}
test("devicetree-tests") {
sources = [
"devicetree-tests.cc",
"matcher-tests.cc",
"node-path-tests.cc",
]
deps = [
"//zircon/kernel/lib/devicetree",
"//zircon/kernel/lib/devicetree/testing",
"//zircon/system/ulib/zxtest",
]
if (is_fuchsia && current_cpu == "arm64") {
# Only arm64 emulation uses a devicetree-based boot shim.
sources += [ "zbi-item-test.cc" ]
deps += [
"//sdk/fidl/fuchsia.boot:fuchsia.boot_hlcpp",
"//sdk/lib/sys/cpp",
"//sdk/lib/zbi-format",
"//zircon/system/ulib/zx",
]
}
}
fuchsia_unittest_package("devicetree-test-package") {
package_name = "devicetree-test"
deps = [
":devicetree-tests",
"//zircon/kernel/lib/devicetree/testing",
]
manifest = "meta/devicetree-tests.cml"
test_specs = {
# The test requires that a ZBI item of type ZBI_TYPE_DEVICETREE exists,
# which is true in the case of the arm64 qemu-boot-shim.
environments = [ emu_env ]
}
test_type = "system"
}
executable("devicetree-extract") {
testonly = true
sources = [ "zbi-item-tool.cc" ]
deps = [
"//sdk/fidl/fuchsia.boot:fuchsia.boot_hlcpp",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//sdk/lib/zbi-format",
"//zircon/system/ulib/zx",
]
}
# To use this tool with a product, use developer overrides for assembly
# to register it as a shell command and add the package to product image.
#
# https://fuchsia.dev/fuchsia-src/development/build/assembly_developer_overrides#add-shell-command
# https://fuchsia.dev/fuchsia-src/development/build/assembly_developer_overrides#add-package
#
fuchsia_package("devicetree-extract-package") {
testonly = true
deps = [ ":devicetree-extract" ]
package_name = "devicetree-extract"
}