| # Copyright 2023 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_library.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| if (is_linux) { |
| host_test_data("simg2img_sources") { |
| sources = [ |
| "//prebuilt/third_party/libsparse/bin/simg2img", |
| "//prebuilt/third_party/libsparse/lib64/libc++.so", |
| ] |
| deps = [] |
| outputs = |
| [ "${root_out_dir}/test_data/storage/sparse/{{source_file_part}}" ] |
| } |
| } |
| |
| rustc_library("lib") { |
| name = "sparse" |
| edition = "2024" |
| with_unit_tests = true |
| |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bincode", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:tempfile", |
| ] |
| if (is_fuchsia) { |
| deps += [ "//sdk/rust/zx" ] |
| } |
| |
| test_deps = [ "//third_party/rust_crates:rand" ] |
| if (is_linux) { |
| test_deps += [ ":simg2img_sources" ] |
| } |
| |
| sources = [ |
| "src/builder.rs", |
| "src/format.rs", |
| "src/lib.rs", |
| "src/reader.rs", |
| ] |
| } |
| |
| fuchsia_unittest_package("sparse-test") { |
| deps = [ ":lib_test" ] |
| manifest = "meta/sparse_test.cml" |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":lib_test($host_toolchain)", |
| ":sparse-test", |
| ] |
| } |