| # 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/fuchsia_unittest_component.gni") |
| import("//build/host.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/testing/host_test.gni") |
| |
| if (is_host) { |
| rustc_library("lib") { |
| with_unit_tests = true |
| edition = "2021" |
| deps = [ |
| "//build/validate:non_production_tag", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//src/storage/fxfs:lib", |
| "//src/storage/fxfs/crypto", |
| "//src/storage/fxfs/crypto/insecure", |
| "//src/storage/lib/storage_device", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:zstd", |
| "//third_party/zstd", |
| ] |
| if (is_linux) { |
| deps += [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:event-listener", |
| "//third_party/rust_crates:fuse3", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:futures-util", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:once_cell", |
| "//third_party/rust_crates:rustc-hash", |
| "//third_party/rust_crates:tokio", |
| ] |
| } |
| sources = [ |
| "src/fuse_attr.rs", |
| "src/fuse_errors.rs", |
| "src/fuse_fs.rs", |
| "src/fuse_vfs.rs", |
| "src/golden.rs", |
| "src/lib.rs", |
| "src/ops.rs", |
| ] |
| name = "tools" |
| } |
| |
| rustc_binary("fxfs_tool") { |
| edition = "2021" |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia", |
| "//src/storage/fxfs:lib($host_toolchain)", |
| "//src/storage/fxfs/crypto", |
| "//src/storage/fxfs/crypto/insecure", |
| "//src/storage/lib/storage_device", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:tracing", |
| ] |
| if (is_linux) { |
| deps += [ |
| "//third_party/rust_crates:fuse3", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:tokio", |
| ] |
| } |
| sources = [ "src/main.rs" ] |
| output_name = "fxfs" |
| } |
| |
| host_test("fxfs_golden_image_test") { |
| binary_path = "${root_out_dir}/fxfs" |
| deps = [ |
| ":fxfs_tool($host_toolchain)", |
| "//src/storage/fxfs/testdata:golden_image_manifest", |
| "//src/storage/fxfs/testdata:golden_images", |
| ] |
| args = [ |
| "check_golden", |
| "--images-dir", |
| "fxfs_golden_images", |
| ] |
| } |
| } |
| |
| install_host_tools("tools") { |
| deps = [ ":fxfs_tool($host_toolchain)" ] |
| outputs = [ "fxfs" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fxfs_golden_image_test($host_toolchain)", |
| ":lib_test($host_toolchain)", |
| ] |
| } |