blob: 95dfedb4cd53927417ba630d6ec0ff610b2e2cd0 [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/images/fvm.gni")
import("//build/test.gni")
import("//src/storage/testing/isolated_devmgr.gni")
import("//src/sys/build/fuchsia_component.gni")
import("//src/sys/build/fuchsia_test_package.gni")
source_set("options") {
public = [ "options.h" ]
public_deps = [ "//src/storage/volume_image:volume-descriptor" ]
}
source_set("fvm-descriptor") {
sources = [ "fvm_descriptor.cc" ]
public = [ "fvm_descriptor.h" ]
public_deps = [
":options",
"//sdk/lib/fit-promise",
"//src/storage/fvm",
"//src/storage/volume_image:partition",
]
deps = [ "//src/storage/volume_image/utils:block-utils" ]
}
source_set("fvm-image-extend") {
sources = [ "fvm_image_extend.cc" ]
public = [ "fvm_image_extend.h" ]
public_deps = [
":options",
"//src/storage/volume_image/utils:io-interfaces",
]
deps = [ "//src/storage/fvm" ]
}
source_set("fvm-sparse-image") {
sources = [
"fvm_sparse_image.cc",
"fvm_sparse_image_reader.cc",
]
public = [ "fvm_sparse_image.h" ]
public_deps = [
":fvm-descriptor",
"//sdk/lib/fit-promise",
"//src/storage/fvm",
"//src/storage/volume_image/utils:compression-interfaces",
"//src/storage/volume_image/utils:io-interfaces",
]
deps = [
"//src/storage/volume_image/utils:block-utils",
"//src/storage/volume_image/utils:lz4-compression",
"//src/storage/volume_image/utils:lz4-decompress-reader",
]
}
# This source set is included in the volume image test package in the directory above.
source_set("fvm-test") {
testonly = true
sources = [
"fvm_descriptor_test.cc",
"fvm_image_extend_test.cc",
"fvm_sparse_image_test.cc",
]
deps = [
":fvm-descriptor",
":fvm-image-extend",
":fvm-sparse-image",
"//sdk/lib/stdcompat",
"//src/lib/json_parser",
"//src/storage/fvm",
"//src/storage/volume_image/serialization:schema",
"//src/storage/volume_image/utils:block-utils",
"//src/storage/volume_image/utils:guid",
"//src/storage/volume_image/utils:lz4-compression",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//zircon/public/lib/lz4",
]
}
test_data_image_path = "$target_out_dir/test_data.blk"
test_blob_image_path = "$target_out_dir/test_blob.blk"
compiled_action("test_data.blk") {
testonly = true
visibility = [ ":*" ]
tool = "//zircon/tools/minfs"
outputs = [ test_data_image_path ]
args = [
rebase_path(test_data_image_path, root_build_dir),
"create",
]
}
compiled_action("test_blob.blk") {
testonly = true
visibility = [ ":*" ]
tool = "//zircon/tools/blobfs"
outputs = [ test_blob_image_path ]
args = [
rebase_path(test_blob_image_path, root_build_dir),
"create",
]
}
test_fvm_data_partition = {
type = "data"
dep = ":test_data.blk"
minimum_inodes =
"600000" # Deliberately chosen so that partition is expanded.
minimum_data_bytes = "10M"
maximum_bytes = "218103808"
}
test_fvm_blob_partition = {
type = "blob"
dep = ":test_blob.blk"
minimum_inodes = blobfs_minimum_inodes
minimum_data_bytes = blobfs_minimum_data_bytes
maximum_bytes = blobfs_maximum_bytes
}
generate_fvm("test_fvm.sparse.blk") {
testonly = true
output_name = "$target_out_dir/test_fvm.sparse.blk"
deps = [
":test_blob.blk",
":test_data.blk",
]
args = fvm_sparse_args
partitions = [
# Place blobfs first, since it is A/B enabled (thus allocates extra slices for B-copies of some
# metadata) and bugs are likely to be detected in partitions added after this partition.
test_fvm_blob_partition,
test_fvm_data_partition,
]
}
resource("test_fvm.sparse.blk-resource") {
testonly = true
sources = [ "$target_out_dir/test_fvm.sparse.blk" ]
outputs = [ "data/{{source_file_part}}" ]
deps = [ ":test_fvm.sparse.blk" ]
}
test("fvm_sparse_image_reader_test") {
testonly = true
sources = [ "fvm_sparse_image_reader_test.cc" ]
deps = [
":fvm-sparse-image",
"//src/lib/fxl/test:gtest_main",
"//src/lib/storage/fs_management",
"//src/storage/bin/blobfs",
"//src/storage/bin/minfs",
"//src/storage/testing:storage_driver_test_support",
"//src/storage/volume_image/ftl:ftl-image",
"//src/storage/volume_image/utils:fd-io",
"//third_party/googletest:gtest",
"//zircon/public/lib/fbl",
"//zircon/system/ulib/block-client",
]
}
storage_isolated_devmgr_unittest_v2_component(
"fvm-sparse-image-reader-tests-component") {
component_name = "fvm-sparse-image-reader-tests"
executable_path = "test/fvm_sparse_image_reader_test"
deps = [
":fvm_sparse_image_reader_test",
":test_fvm.sparse.blk-resource",
]
}
fuchsia_test_package("fvm-sparse-image-reader-tests") {
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
test_components = [ ":fvm-sparse-image-reader-tests-component" ]
}
group("tests") {
testonly = true
deps = [
":fvm-sparse-image-reader-tests",
"//src/storage/testing:storage-isolated-devmgr",
]
}