| # Copyright 2021 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/components/fuchsia_unittest_component.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_macro.gni") |
| import("//src/storage/fs_test/suite.gni") |
| import("//src/storage/testing/driver_test_realm.gni") |
| |
| fxfs_deps = [ |
| ":fxfs_macros", |
| "//src/lib/async-utils", |
| "//src/lib/fuchsia-async", |
| "//src/lib/storage/storage_device", |
| "//src/storage/lib/interval_tree", |
| "//third_party/rust_crates:aes", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-lock", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:bincode", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:chacha20", |
| "//third_party/rust_crates:either", |
| "//third_party/rust_crates:event-listener", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:pin-project", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:slab", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//third_party/rust_crates:uuid", |
| "//third_party/rust_crates:xts-mode", |
| ] |
| |
| fxfs_test_deps = [ "//third_party/rust_crates:assert_matches" ] |
| |
| fxfs_sources = [ |
| "src/checksum.rs", |
| "src/crypt.rs", |
| "src/data_buffer.rs", |
| "src/debug_assert_not_too_long.rs", |
| "src/errors.rs", |
| "src/ff1.rs", |
| "src/filesystem.rs", |
| "src/fsck.rs", |
| "src/fsck/errors.rs", |
| "src/fsck/store_scanner.rs", |
| "src/fsck/tests.rs", |
| "src/lib.rs", |
| "src/log.rs", |
| "src/lsm_tree.rs", |
| "src/lsm_tree/merge.rs", |
| "src/lsm_tree/simple_persistent_layer.rs", |
| "src/lsm_tree/skip_list_layer.rs", |
| "src/lsm_tree/types.rs", |
| "src/metrics.rs", |
| "src/metrics/stubs.rs", |
| "src/metrics/traits.rs", |
| "src/object_handle.rs", |
| "src/object_handle/bootstrap.rs", |
| "src/object_store.rs", |
| "src/object_store/allocator.rs", |
| "src/object_store/allocator/merge.rs", |
| "src/object_store/caching_object_handle.rs", |
| "src/object_store/directory.rs", |
| "src/object_store/extent_record.rs", |
| "src/object_store/flush.rs", |
| "src/object_store/graveyard.rs", |
| "src/object_store/journal.rs", |
| "src/object_store/journal/checksum_list.rs", |
| "src/object_store/journal/reader.rs", |
| "src/object_store/journal/super_block.rs", |
| "src/object_store/journal/writer.rs", |
| "src/object_store/merge.rs", |
| "src/object_store/object_manager.rs", |
| "src/object_store/object_record.rs", |
| "src/object_store/store_object_handle.rs", |
| "src/object_store/testing.rs", |
| "src/object_store/testing/fake_allocator.rs", |
| "src/object_store/testing/fake_filesystem.rs", |
| "src/object_store/transaction.rs", |
| "src/object_store/tree.rs", |
| "src/object_store/volume.rs", |
| "src/object_store/writeback_cache.rs", |
| "src/platform.rs", |
| "src/range.rs", |
| "src/round.rs", |
| "src/serialized_types.rs", |
| "src/serialized_types/test_traits.rs", |
| "src/serialized_types/tests.rs", |
| "src/serialized_types/traits.rs", |
| "src/serialized_types/types.rs", |
| "src/testing.rs", |
| "src/testing/fake_object.rs", |
| "src/trace.rs", |
| ] |
| |
| if (is_fuchsia) { |
| fxfs_deps += [ |
| ":fuchsia.fxfs-rustc", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs-rustc", |
| "//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block-rustc", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle-rustc", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/diagnostics/log/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/block_client/rust:remote-block-device", |
| "//src/lib/storage/fs_inspect", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/storage/fidl/fuchsia.fs.startup:fuchsia.fs.startup-rustc", |
| ] |
| fxfs_test_deps += [ |
| ":fxfs-test-manifest", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/storage/fs_management/rust:fs_management", |
| "//src/lib/storage/ramdevice_client/rust:ramdevice_client", |
| "//src/storage/fxfs-crypt:lib", |
| "//src/sys/pkg/lib/fuchsia-merkle", |
| "//third_party/rust_crates:aes-gcm-siv", |
| "//third_party/rust_crates:zstd", |
| "//third_party/zstd", |
| ] |
| fxfs_sources += [ |
| "src/platform/fuchsia.rs", |
| "src/platform/fuchsia/component.rs", |
| "src/platform/fuchsia/device.rs", |
| "src/platform/fuchsia/directory.rs", |
| "src/platform/fuchsia/errors.rs", |
| "src/platform/fuchsia/file.rs", |
| "src/platform/fuchsia/log.rs", |
| "src/platform/fuchsia/metrics.rs", |
| "src/platform/fuchsia/node.rs", |
| "src/platform/fuchsia/pager.rs", |
| "src/platform/fuchsia/remote_crypt.rs", |
| "src/platform/fuchsia/testing.rs", |
| "src/platform/fuchsia/vmo_data_buffer.rs", |
| "src/platform/fuchsia/volume.rs", |
| "src/platform/fuchsia/volumes_directory.rs", |
| ] |
| } |
| |
| rustc_macro("fxfs_macros") { |
| edition = "2021" |
| name = "fxfs_macros" |
| deps = [ |
| "//third_party/rust_crates:proc-macro2", |
| "//third_party/rust_crates:quote", |
| "//third_party/rust_crates:syn", |
| ] |
| source_root = "macros/macros.rs" |
| sources = [ "macros/macros.rs" ] |
| } |
| |
| rustc_library("lib") { |
| edition = "2021" |
| with_unit_tests = true |
| name = "fxfs" |
| |
| deps = fxfs_deps |
| sources = fxfs_sources |
| test_deps = fxfs_test_deps |
| |
| features = [] |
| if (is_fuchsia) { |
| features += [ "tracing" ] |
| } |
| if (is_host) { |
| features += [ "insecure_crypt" ] |
| deps += [ "//third_party/rust_crates:aes-gcm-siv" ] |
| } |
| } |
| |
| group("fxfs-test-manifest") { |
| metadata = { |
| test_component_manifest_cml = [ |
| { |
| use = [ |
| { |
| # This allows tests to launch BlobFS |
| protocol = [ "fuchsia.process.Launcher" ] |
| }, |
| ] |
| }, |
| ] |
| } |
| } |
| |
| storage_driver_test_realm_v2_component("fxfs-test") { |
| deps = [ ":lib_test" ] |
| } |
| |
| fuchsia_test_package("fxfs-tests") { |
| test_components = [ ":fxfs-test" ] |
| } |
| |
| rustc_binary("fxfs") { |
| edition = "2021" |
| deps = [ |
| ":fuchsia.fxfs-rustc", |
| ":lib", |
| "//src/lib/diagnostics/log/rust", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/block_client/rust:remote-block-device", |
| "//src/lib/storage/storage_device", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:tracing", |
| ] |
| sources = [ "src/main.rs" ] |
| |
| if (is_fuchsia) { |
| features = [ "tracing" ] |
| } |
| } |
| |
| fuchsia_component("fxfs_component") { |
| manifest = "meta/fxfs.cml" |
| component_name = "fxfs" |
| deps = [ ":fxfs" ] |
| } |
| |
| fuchsia_shell_package("fxfs-bin") { |
| deps = [ ":fxfs" ] |
| } |
| |
| fidl("fuchsia.fxfs") { |
| sources = [ "fidl/fxfs.fidl" ] |
| public_deps = [ |
| "//sdk/fidl/fuchsia.io", |
| "//zircon/vdso/zx", |
| ] |
| } |
| |
| fs_test_config("fxfs") { |
| is_component = true |
| max_file_size = 9223372036854775807 |
| supports_hard_links = true |
| supports_inspect = true |
| supports_resize = true |
| supports_mmap = true |
| supports_mmap_shared_write = false |
| supports_shutdown_on_no_connections = true |
| timestamp_granularity = 1 |
| uses_crypt = true |
| |
| options = [ |
| { |
| description = "Fxfs" |
| use_fvm = false |
| has_min_volume_size = true |
| |
| device_block_count = 24576 |
| device_block_size = 512 |
| }, |
| ] |
| } |
| |
| test("fxfs-interop-fs") { |
| sources = [ "test/fs_test.cc" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.io", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/storage/block_client/cpp", |
| "//src/storage/fs_test", |
| "//src/storage/fs_test:test_crypt_service", |
| "//src/storage/fxfs", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fdio-caller", |
| ] |
| |
| # TODO(fxbug.dev/95833): This target uses the deprecated C bindings. |
| # Consider switching to the C++ bindings. See linked bug for details. |
| configs += [ "//build/c:fidl-deprecated-c-bindings" ] |
| } |
| |
| storage_driver_test_realm_v2_component("fxfs-interop-fs-tests") { |
| deps = [ |
| ":fxfs-interop-fs", |
| ":test_fxfs_component_manifest_shard", |
| ] |
| } |
| |
| expect_includes("test_fxfs_component_manifest_shard") { |
| testonly = true |
| includes = [ "meta/test_fxfs.shard.cml" ] |
| } |
| |
| fs_test_suite("fxfs") { |
| deps = [ |
| ":fxfs_component", |
| ":fxfs_fs_test_config", |
| "//src/storage/fxfs", |
| "//src/storage/fxfs-crypt", |
| ] |
| extra_components = [ ":fxfs-interop-fs-tests" ] |
| component_deps = [ |
| ":test_fxfs_component_manifest_shard", |
| "//src/storage/fs_test:test_crypt_service", |
| ] |
| } |
| |
| slow_fs_test_suite("fxfs") { |
| deps = [ |
| ":fxfs_component", |
| ":fxfs_fs_test_config", |
| "//src/storage/fxfs", |
| "//src/storage/fxfs-crypt", |
| ] |
| component_deps = [ |
| ":test_fxfs_component_manifest_shard", |
| "//src/storage/fs_test:test_crypt_service", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fxfs-fs-tests", |
| ":fxfs-slow-fs-tests", |
| ":fxfs-tests", |
| ":fxfs_component", |
| ":lib_test($host_toolchain)", |
| "//src/storage/fxfs/tools:tests", |
| ] |
| } |