blob: 064582459d8745bd5dd28701c461dd0083ad4b06 [file] [log] [blame]
# Copyright 2020 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/components.gni")
import("//build/test.gni")
group("test") {
testonly = true
# avb library in tree uses <endian.h>, which is not available on mac.
# Therefore we disable the test now for mac platform. Once upstream
# avb is updated to fix the endian.h header issue, re-enable it.
if (host_os != "mac") {
deps = [
":firmware_zircon_boot_test($host_toolchain)",
":gpt_boot_demo_test($host_toolchain)",
]
}
}
source_set("mock_zircon_boot_lib") {
public = [ "../include/lib/zircon_boot/test/mock_zircon_boot_ops.h" ]
include_dirs = [ ".." ]
sources = [ "mock_zircon_boot_ops.cc" ]
deps = [
"//src/firmware/lib/zbi:in_tree",
"//src/firmware/lib/zircon_boot:in_tree",
"//src/lib/digest",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxtest",
"//zircon/third_party/ulib/cksum",
]
}
test("firmware_zircon_boot_test") {
sources = [
"zbi_utils.cc",
"zircon_boot.cc",
]
deps = [
":mock_zircon_boot_lib",
"//src/firmware/lib/abr:in_tree",
"//src/firmware/lib/zbi:in_tree",
"//src/firmware/lib/zircon_boot:in_tree",
"//third_party/android/platform/external/avb:sysdeps-posix",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxtest",
]
}
test("gpt_boot_demo_test") {
deps = [ "..:gpt_boot_demo_lib" ]
}
# The factory bootfs zbi util implementation is tested directly with the
# "customer" library src/sys/lib/fuchsia-bootfs, which is used by the factory
# item service implementation to extract the bootfs files. The library is only
# available in the fuchsia tool chain. Therefore we need to write the test as a
# fuchsia test package to run on device directly.
#
# Additionally, the library is written in rust. In order to use it for our cpp
# unittest, we write a rust static library in rust/factory_bootfs_util that
# exposes a C wrapper for the interface.
test("factory-bootfs-test") {
sources = [ "factory_bootfs_zbi.cc" ]
deps = [
"rust/factory_bootfs_util:factory-bootfs-util",
"//src/firmware/lib/zircon_boot:in_tree",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxtest",
]
}
# Run with `fx test bootfs-factory-test-package`.
fuchsia_unittest_package("factory-bootfs-test-package") {
deps = [ ":factory-bootfs-test" ]
}