| # 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/rust/rustc_binary.gni") |
| import("//build/rust/rustc_fuzzer.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//src/sys/build/components.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/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" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-fatfs-fuzzer", |
| ":fuchsia-fatfs-tests", |
| "//src/storage/fuchsia-fatfs/mounter:tests", |
| ] |
| } |
| |
| 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" ] |
| } |