| # Copyright 2019 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. |
| |
| ########################################## |
| # Though under //zircon, this build file # |
| # is meant to be used in the Fuchsia GN # |
| # build. # |
| # See fxb/36139. # |
| ########################################## |
| |
| assert(!defined(zx) || zx != "/", |
| "This file can only be used in the Fuchsia GN build.") |
| |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/test.gni") |
| import("//build/unification/zbi/bootfs_test.gni") |
| import("//src/storage/blobfs/test/blobfs_large_integration_test.gni") |
| import("//src/sys/build/components.gni") |
| |
| group("test") { |
| testonly = true |
| deps = [ ":blobfs-unittest" ] |
| } |
| |
| group("host_tests") { |
| testonly = true |
| deps = [ ":blobfs-host" ] |
| } |
| |
| # TODO(fxb/52911): Remove once all targets migrated to test packages. |
| group("bootfs-tests") { |
| testonly = true |
| deps = [ |
| ":blobfs-integration-bootfs-test", |
| ":blobfs-integration-paged-bootfs-test", |
| ":blobfs-large-integration-fragmentation-bootfs-test", |
| ":blobfs-large-integration-fragmentation-paged-bootfs-test", |
| ":blobfs-large-integration-max-reservation-bootfs-test", |
| ":blobfs-large-integration-max-reservation-paged-bootfs-test", |
| ":blobfs-large-integration-no-space-bootfs-test", |
| ":blobfs-large-integration-no-space-paged-bootfs-test", |
| ":blobfs-large-integration-short-bootfs-test", |
| ":blobfs-large-integration-short-paged-bootfs-test", |
| ":blobfs-large-integration-use-second-bitmap-bootfs-test", |
| ":blobfs-large-integration-use-second-bitmap-paged-bootfs-test", |
| ] |
| } |
| |
| executable("test_binary") { |
| testonly = true |
| sources = [ "test_binary_main.cc" ] |
| visibility = [ ":*" ] |
| } |
| |
| resource("test-binary") { |
| testonly = true |
| data_deps = [ ":test_binary" ] |
| sources = [ "$root_out_dir/test_binary" ] |
| outputs = [ "data/test_binary" ] |
| visibility = [ ":*" ] |
| } |
| |
| config("test-utils-headers") { |
| # blob_utils.h is referred to as test/blob_utils.h. |
| include_dirs = [ ".." ] |
| } |
| |
| # TODO(fxbug.dev/52911): Remove migration target |
| source_set("test-utils-zxtest") { |
| testonly = true |
| defines = [ "BLOBFS_USE_ZXTEST" ] |
| sources = [ |
| "blob_utils.cc", |
| "blob_utils.h", |
| ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/digest", |
| ] |
| public_deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| ] |
| public_configs = [ ":test-utils-headers" ] |
| } |
| |
| source_set("test-utils") { |
| testonly = true |
| sources = [ |
| "blob_utils.cc", |
| "blob_utils.h", |
| ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/fbl", |
| "//zircon/system/ulib/digest", |
| ] |
| public_deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| ] |
| public_configs = [ ":test-utils-headers" ] |
| } |
| |
| test("blobfs_unittest") { |
| sources = [ |
| "unit/allocated-extent-iterator-test.cc", |
| "unit/allocator-test.cc", |
| "unit/blob-cache-test.cc", |
| "unit/blob-loader-test.cc", |
| "unit/blob-test.cc", |
| "unit/blob-verifier-test.cc", |
| "unit/blobfs-checker-test.cc", |
| "unit/blobfs-pager-test.cc", |
| "unit/blobfs-test.cc", |
| "unit/blobfs_inspector_test.cc", |
| "unit/compression-settings-test.cc", |
| "unit/compressor-test.cc", |
| "unit/create-tests.cc", |
| "unit/extent-reserver-test.cc", |
| "unit/format-test.cc", |
| "unit/fsck-test.cc", |
| "unit/get-allocated-regions-test.cc", |
| "unit/metrics-test.cc", |
| "unit/node-populator-test.cc", |
| "unit/node-reserver-test.cc", |
| "unit/pager-watchdog-test.cc", |
| "unit/parser_test.cc", |
| "unit/seekable-compressor-test.cc", |
| "unit/utils.cc", |
| "unit/vector-extent-iterator-test.cc", |
| "unit/zstd-compressed-block-collection-test.cc", |
| "unit/zstd-seekable-blob-test.cc", |
| ] |
| deps = [ |
| ":test-utils", |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_c", |
| "//sdk/lib/sys/inspect/cpp", |
| "//src/lib/chunked-compression", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/blobfs", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/cksum", |
| "//zircon/public/lib/lz4", |
| "//zircon/public/lib/safemath", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zstd", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/block-client:fake-device", |
| "//zircon/system/ulib/fidl-utils", |
| "//zircon/system/ulib/fs-management", |
| "//zircon/system/ulib/fs-test-utils", |
| "//zircon/system/ulib/id_allocator", |
| "//zircon/system/ulib/storage/buffer", |
| "//zircon/system/ulib/storage/operation", |
| ] |
| } |
| |
| fuchsia_unittest_package("blobfs-unittest") { |
| manifest = "meta/blobfs-unittest.cmx" |
| deps = [ |
| ":blobfs_unittest", |
| ":test-binary", |
| ] |
| } |
| |
| test("blobfs-host") { |
| sources = [ "host/host-test.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| source_set("integration-fixtures") { |
| testonly = true |
| sources = [ "integration/blobfs_fixtures.cc" ] |
| deps = [ |
| ":test-utils-zxtest", |
| "//sdk/lib/fdio", |
| "//src/storage/blobfs", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/fs-test-utils", |
| "//zircon/system/ulib/fs/test_support", |
| "//zircon/system/ulib/fvm", |
| ] |
| } |
| |
| test("blobfs-integration") { |
| output_name = "blobfs-integration-test" |
| |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| configs += [ "//build/config:all_source" ] |
| sources = [ |
| "integration/blobfs_integration_test.cc", |
| "integration/fdio_test.cc", |
| "integration/fdio_test.h", |
| "integration/integration_main.cc", |
| "integration/mount_test.cc", |
| "integration/nand_test.cc", |
| "integration/nand_test.h", |
| "integration/query_service_test.cc", |
| "integration/superblock-test.cc", |
| "integration/sync_test.cc", |
| ] |
| deps = [ |
| ":integration-fixtures", |
| ":test-utils-zxtest", |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_c", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_llcpp", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_llcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/inspect/cpp", |
| "//src/devices/block/bin/ftl_proxy:ftl-util", |
| "//src/storage/blobfs", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/block-client:fake-device", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fidl-utils", |
| "//zircon/system/ulib/fs-test-utils", |
| "//zircon/system/ulib/fs/test_support", |
| "//zircon/system/ulib/fvm", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/id_allocator", |
| "//zircon/system/ulib/memfs", |
| "//zircon/system/ulib/ramdevice-client", |
| ] |
| public_deps = [ "//zircon/system/ulib/fidl-utils" ] |
| } |
| |
| bootfs_test("blobfs-integration-bootfs-test") { |
| name = "blobfs-integration-test" |
| deps = [ ":blobfs-integration" ] |
| } |
| |
| source_set("load-generator") { |
| testonly = true |
| sources = [ "integration/load_generator.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/fs-test-utils", |
| ] |
| public_deps = [ ":test-utils-zxtest" ] |
| } |
| |
| blobfs_large_integration_test("fragmentation") { |
| sources = [ "integration/large/fragmentation.cc" ] |
| } |
| |
| blobfs_large_integration_test("max-reservation") { |
| sources = [ "integration/large/max-reservation.cc" ] |
| } |
| |
| blobfs_large_integration_test("no-space") { |
| sources = [ "integration/large/no-space.cc" ] |
| } |
| |
| blobfs_large_integration_test("short") { |
| sources = [ "integration/large/short.cc" ] |
| } |
| |
| blobfs_large_integration_test("use-second-bitmap") { |
| sources = [ "integration/large/use-second-bitmap.cc" ] |
| } |
| |
| test("blobfs-integration-paged-test") { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| sources = [ |
| "integration/blobfs_integration_paged_main.cc", |
| "integration/launch.cc", |
| ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| bootfs_test("blobfs-integration-paged-bootfs-test") { |
| name = "blobfs-integration-paged-test" |
| deps = [ ":blobfs-integration-paged-test" ] |
| } |
| |
| fuzzer("zstd-fuzzer") { |
| sources = [ "zstd-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| |
| # TODO(57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/zstd", |
| ] |
| } |
| |
| fuzzer("lz4-fuzzer") { |
| sources = [ "lz4-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| "//zircon/public/lib/lz4", |
| ] |
| } |
| |
| fuzzer("zstd-seekable-symmetric-fuzzer") { |
| sources = [ "zstd-seekable-symmetric-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| |
| # TODO(57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/zstd:zstdseek", |
| ] |
| } |
| |
| fuzzer("zstd-seekable-fuzzer") { |
| sources = [ "zstd-seekable-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| |
| # TODO(57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/zstd:zstdseek", |
| ] |
| } |
| |
| executable("blobfs-load-generator") { |
| testonly = true |
| sources = [ "integration/load_generator_main.cc" ] |
| deps = [ |
| ":load-generator", |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/fs-test-utils", |
| ] |
| } |