| # 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/rust/rustc_binary.gni") |
| import("//build/rust/rustc_fuzzer.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//src/storage/fs_test/suite.gni") |
| |
| fatfs_deps = [ |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/storage/block_client/rust:remote-block-device", |
| "//src/lib/storage/storage_device", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:fatfs", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:scopeguard", |
| "//third_party/rust_crates:static_assertions", |
| ] |
| |
| fatfs_sources = [ |
| "src/directory.rs", |
| "src/file.rs", |
| "src/filesystem.rs", |
| "src/lib.rs", |
| "src/node.rs", |
| "src/refs.rs", |
| "src/types.rs", |
| "src/util.rs", |
| ] |
| |
| rustc_library("lib") { |
| edition = "2018" |
| with_unit_tests = true |
| name = "fuchsia_fatfs" |
| |
| deps = fatfs_deps |
| sources = fatfs_sources |
| } |
| |
| fuchsia_component("fuchsia-fatfs-test") { |
| testonly = true |
| deps = [ ":lib_test" ] |
| manifest = "meta/fuchsia_fatfs_lib_test.cml" |
| } |
| |
| fuchsia_test_package("fuchsia-fatfs-tests") { |
| test_components = [ ":fuchsia-fatfs-test" ] |
| } |
| |
| rustc_fuzzer("fat-fuzzer") { |
| rustfunction = "fuzz_fatfs" |
| |
| corpus = "corpus" |
| options = [ |
| "-rss_limit_mb=3072", |
| |
| # Set a reasonably low per-task timeout in case the filesystem has problems that cause infinite |
| # loops in the fuzzing code (e.g. cycles in the directory tree). |
| "-timeout=60", |
| ] |
| |
| sources = [ "src/fuzzer.rs" ] + fatfs_sources |
| deps = fatfs_deps |
| |
| non_rust_deps = [ "//zircon/system/ulib/syslog" ] |
| } |
| |
| fuzzers_package("fuchsia-fatfs-fuzzer") { |
| rust_fuzzers = [ ":fat-fuzzer" ] |
| } |
| |
| rustc_binary("fatfs") { |
| edition = "2018" |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/storage/block_client/rust:remote-block-device", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| fuchsia_package("fuchsia-fatfs") { |
| deps = [ "//src/storage/fuchsia-fatfs/mounter:fatfs-mounter" ] |
| } |
| |
| fuchsia_shell_package("fatfs-bin") { |
| deps = [ ":fatfs" ] |
| } |
| |
| # FAT has different filename rules compared to other filesystems, so we substitute the |
| # filename tests in the test suite with a different set. |
| test("fat_filename_tests") { |
| sources = [ "filename_tests.cc" ] |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/fs_test", |
| ] |
| } |
| |
| storage_isolated_devmgr_unittest_v2_component("fatfs-fat-filename-tests") { |
| deps = [ ":fat_filename_tests" ] |
| } |
| |
| fs_test_suite("fatfs") { |
| deps = [ |
| "//src/storage/fuchsia-fatfs:fatfs", |
| "//zircon/third_party/uapp/fsck-msdosfs", |
| "//zircon/third_party/uapp/mkfs-msdosfs", |
| ] |
| config = { |
| disk_format = 4 |
| is_case_sensitive = false |
| is_journaled = false |
| timestamp_granularity = 2000000000 |
| supports_hard_links = false |
| supports_resize = false |
| supports_sparse_files = false |
| max_file_size = 4294967295 |
| is_slow = true |
| sectors_per_cluster = 2 |
| supports_watch_event_deleted = false |
| } |
| |
| omit_components = [ |
| ":fatfs-filename-tests", |
| ":fatfs-query-filesystem-tests", |
| ] |
| extra_components = [ ":fatfs-fat-filename-tests" ] |
| } |
| |
| slow_fs_test_suite("fatfs") { |
| deps = [ |
| ":fatfs_fs_test_config", |
| "//src/storage/fuchsia-fatfs:fatfs", |
| "//zircon/third_party/uapp/fsck-msdosfs", |
| "//zircon/third_party/uapp/mkfs-msdosfs", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fatfs-fs-tests", |
| ":fatfs-slow-fs-tests", |
| ":fuchsia-fatfs-fuzzer", |
| ":fuchsia-fatfs-tests", |
| "//src/storage/fuchsia-fatfs/mounter:tests", |
| ] |
| } |