| # 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. |
| |
| import("//build/fuzzing/fuzzer.gni") |
| import("//build/test.gni") |
| import("//src/lib/isolated_devmgr/v2_component/isolated_devmgr.gni") |
| import("//src/sys/build/components.gni") |
| |
| group("test") { |
| testonly = true |
| deps = [ |
| ":blobfs-fuzzers", |
| ":blobfs-host($host_toolchain)", |
| ":blobfs-integration-package", |
| ":blobfs-unittest", |
| "//src/lib/isolated_devmgr/v2_component", |
| ] |
| } |
| |
| 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 = [ ":*" ] |
| } |
| |
| 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" ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| test("blobfs_unittest") { |
| sources = [ |
| "unit/allocated-extent-iterator-test.cc", |
| "unit/allocator-test.cc", |
| "unit/blob-cache-test.cc", |
| "unit/blob-layout-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-revision-test.cc", |
| "unit/blobfs-test.cc", |
| "unit/blobfs_inspector_test.cc", |
| "unit/common-test.cc", |
| "unit/compression-settings-test.cc", |
| "unit/compressor-test.cc", |
| "unit/create-tests.cc", |
| "unit/decompressor-sandbox-test.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/parser_test.cc", |
| "unit/seekable-compressor-test.cc", |
| "unit/utils.cc", |
| "unit/vector-extent-iterator-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", |
| "//src/storage/blobfs:decompressor-impl", |
| "//src/storage/blobfs:fuchsia.blobfs.internal", |
| "//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/id_allocator", |
| "//zircon/system/ulib/storage/buffer", |
| "//zircon/system/ulib/storage/operation", |
| ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| fuchsia_unittest_package("blobfs-unittest") { |
| manifest = "meta/blobfs-unittest.cml" |
| deps = [ |
| ":blobfs_unittest", |
| ":test-binary", |
| ] |
| } |
| |
| test("blobfs-host") { |
| sources = [ "host/host-test.cc" ] |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/blobfs", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| test("external_decompressor_integration") { |
| sources = [ |
| "integration/external-decompressor_test.cc", |
| "integration/fdio_test.cc", |
| "integration/fdio_test.h", |
| ] |
| deps = [ |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/blobfs:blobfs", |
| "//src/storage/blobfs:fuchsia.blobfs.internal", |
| "//src/storage/blobfs/test:test-utils", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| "//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/fzl", |
| "//zircon/system/ulib/id_allocator", |
| ] |
| } |
| |
| fuchsia_unittest_component("external-decompressor-integration") { |
| manifest = "meta/external-decompressor-integration.cml" |
| deps = [ |
| ":external_decompressor_integration", |
| ":test-binary", |
| ] |
| } |
| |
| fuchsia_unittest_component("external-decompressor-runner") { |
| manifest = "meta/external-decompressor-runner.cml" |
| } |
| |
| test("blobfs-integration") { |
| output_name = "blobfs-integration-test" |
| |
| # We need some extra system flags that the _ALL_SOURCE define exposes. |
| configs += [ "//build/config:all_source" ] |
| |
| sources = [ |
| "integration/blobfs_fixtures.cc", |
| "integration/blobfs_integration_test.cc", |
| "integration/fdio_test.cc", |
| "integration/fdio_test.h", |
| "integration/mount_test.cc", |
| "integration/query_service_test.cc", |
| "integration/superblock-test.cc", |
| "integration/sync_test.cc", |
| ] |
| deps = [ |
| ":test-utils", |
| "//sdk/fidl/fuchsia.blobfs:fuchsia.blobfs_c", |
| "//sdk/fidl/fuchsia.fs:fuchsia.fs_llcpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/inspect/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/blobfs", |
| "//src/storage/fs_test", |
| "//src/storage/fvm", |
| "//src/storage/lib/utils:topological_path", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/zx", |
| "//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/fzl", |
| "//zircon/system/ulib/id_allocator", |
| "//zircon/system/ulib/memfs", |
| "//zircon/system/ulib/ramdevice-client", |
| ] |
| public_deps = [ "//zircon/system/ulib/fidl-utils" ] |
| } |
| |
| isolated_devmgr_unittest_v2_component("blobfs-integration-component") { |
| executable_path = "test/blobfs-integration-test" |
| component_name = "blobfs-integration" |
| |
| deps = [ |
| ":blobfs-integration", |
| "//src/devices/block/bin/blktest", |
| "//src/devices/block/bin/iochk", |
| "//src/devices/block/drivers/core", |
| "//src/devices/block/drivers/ftl", |
| "//src/devices/block/drivers/ramdisk", |
| "//src/devices/board/drivers/integration-test", |
| "//src/devices/bus/drivers/platform", |
| "//src/devices/misc/drivers/test", |
| "//src/devices/nand/drivers/nand", |
| "//src/devices/nand/drivers/ram-nand", |
| "//src/devices/tests/sysdev", |
| "//src/storage/fvm/driver", |
| ] |
| } |
| |
| test("executable_mount") { |
| testonly = true |
| sources = [ |
| "integration/executable_mount_test.cc", |
| "integration/fdio_test.cc", |
| "integration/fdio_test.h", |
| ] |
| deps = [ |
| ":test-utils", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_llcpp", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/fbl", |
| "//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/id_allocator", |
| ] |
| } |
| |
| fuchsia_component("executable-mount-test") { |
| testonly = true |
| manifest = "meta/executable-mount-test.cmx" |
| deps = [ ":executable_mount" ] |
| } |
| |
| template("blobfs_large_integration_test") { |
| test_name = target_name |
| component_name = "${target_name}-component" |
| |
| test(test_name) { |
| output_name = invoker.target_name |
| |
| sources = [ "integration/blobfs_fixtures.cc" ] |
| if (defined(invoker.sources)) { |
| sources += invoker.sources |
| } |
| |
| deps = [ |
| ":load-generator", |
| ":test-utils", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_llcpp", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/storage/blobfs", |
| "//src/storage/fs_test", |
| "//src/storage/fvm", |
| "//third_party/googletest:gtest", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/memfs", |
| ] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| } |
| |
| isolated_devmgr_unittest_v2_component(component_name) { |
| executable_path = "test/$test_name" |
| component_name = test_name |
| deps = [ ":$test_name" ] |
| } |
| } |
| |
| blobfs_large_integration_test("blobfs-fragmentation") { |
| sources = [ "integration/large/fragmentation.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-max-reservation") { |
| sources = [ "integration/large/max-reservation.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-no-space") { |
| sources = [ "integration/large/no-space.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-use-second-bitmap") { |
| sources = [ "integration/large/use-second-bitmap.cc" ] |
| } |
| |
| fuchsia_test_package("blobfs-integration-package") { |
| package_name = "blobs-integration" |
| test_components = [ |
| ":blobfs-fragmentation-component", |
| ":blobfs-integration-component", |
| ":blobfs-max-reservation-component", |
| ":blobfs-no-space-component", |
| ":blobfs-use-second-bitmap-component", |
| ":executable-mount-test", |
| ":external-decompressor-runner", |
| ] |
| deps = [ |
| ":external-decompressor-integration", |
| "//src/storage/blobfs:decompressor-sandbox", |
| ] |
| } |
| |
| source_set("load-generator") { |
| testonly = true |
| sources = [ "integration/load_generator.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//third_party/googletest:gtest", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zircon-internal", |
| ] |
| public_deps = [ ":test-utils" ] |
| } |
| |
| fuzzer("zstd-fuzzer") { |
| sources = [ "zstd-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/ulib/zstd", |
| ] |
| } |
| |
| fuzzer("lz4-fuzzer") { |
| sources = [ "lz4-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//zircon/public/lib/lz4", |
| ] |
| } |
| |
| fuzzer("zstd-seekable-symmetric-fuzzer") { |
| sources = [ "zstd-seekable-symmetric-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/ulib/zstd:zstdseek", |
| ] |
| } |
| |
| fuzzer("zstd-seekable-fuzzer") { |
| sources = [ "zstd-seekable-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| |
| # TODO(fxbug.dev/57392): Move it back to //third_party once unification completes. |
| "//zircon/third_party/ulib/zstd:zstdseek", |
| ] |
| } |
| |
| fuzzers_package("blobfs-fuzzers") { |
| cpp_fuzzers = [ |
| ":zstd-fuzzer", |
| ":zstd-seekable-fuzzer", |
| ":zstd-seekable-symmetric-fuzzer", |
| ] |
| } |
| |
| 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", |
| ] |
| } |