blob: 3757898a508812ba065b7b9663715ed4ba7ec289 [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/lib/isolated_devmgr/v2_component/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",
"//src/storage/volume_image:partition",
"//zircon/public/lib/fit",
]
deps = [
"//src/storage/fvm",
"//src/storage/volume_image/utils:block-utils",
]
}
source_set("fvm-sparse-image") {
sources = [
"fvm_sparse_image.cc",
"fvm_sparse_image_reader.cc",
]
public = [ "fvm_sparse_image.h" ]
public_deps = [
":fvm-descriptor",
"//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",
]
}
# 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_sparse_image_test.cc",
]
deps = [
":fvm-descriptor",
":fvm-sparse-image",
"//src/lib/json_parser",
"//src/storage/fvm",
"//src/storage/volume_image/serialization:schema",
"//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"
compiled_action("test_data.blk") {
testonly = true
tool = "//zircon/tools/minfs"
outputs = [ test_data_image_path ]
args = [
rebase_path(test_data_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"
}
generate_fvm("test_fvm.sparse.blk") {
testonly = true
output_name = "$target_out_dir/test_fvm.sparse.blk"
deps = [ ":test_data.blk" ]
args = fvm_sparse_args
partitions = [ 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/isolated_devmgr/v2_component:client",
"//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",
"//zircon/system/ulib/fs-management",
]
}
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_components = [ ":fvm-sparse-image-reader-tests-component" ]
}
group("tests") {
testonly = true
deps = [
":fvm-sparse-image-reader-tests",
"//src/lib/isolated_devmgr/v2_component",
]
}