blob: cb456de77c83ec6c025939764a76edbaf4f96bf9 [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" ]
deps = [
"//zircon/kernel/lib/devicetree",
"//zircon/system/ulib/zxtest",
]
if (is_host) {
data_deps = [ ":host-test-data" ]
} else 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",
"//sdk/lib/sys/cpp",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxc",
]
}
}
# The binary, flattened devicetrees files created by data/update.sh.
dtb_sources = [
"data/complex_no_properties.dtb",
"data/empty.dtb",
"data/memory_reservations.dtb",
"data/simple_with_properties.dtb",
]
if (is_host) {
host_test_data("host-test-data") {
sources = dtb_sources
outputs = [ "$root_out_dir/test_data/devicetree/{{source_file_part}}" ]
}
}
resource("dtb_resources") {
sources = dtb_sources
outputs = [ "data/{{source_file_part}}" ]
}
fuchsia_unittest_package("devicetree-test-package") {
package_name = "devicetree-test"
deps = [
":devicetree-tests",
":dtb_resources",
]
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 ]
}
}
executable("devicetree-extract") {
testonly = true
sources = [ "zbi-item-tool.cc" ]
deps = [
"//sdk/fidl/fuchsia.boot",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//sdk/lib/sys/cpp",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxc",
]
}
fuchsia_shell_package("devicetree-extract-package") {
testonly = true
deps = [ ":devicetree-extract" ]
package_name = "devicetree-extract"
}