| # 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/sys/build/components.gni") |
| import("//zircon/system/ulib/devmgr-integration-test/isolated_devmgr.gni") |
| |
| group("test") { |
| testonly = true |
| deps = [ |
| ":blobfs-fuzzers", |
| ":blobfs-host($host_toolchain)", |
| ":blobfs-integration-package", |
| ":blobfs-unittest", |
| ] |
| } |
| |
| 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" ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| 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" ] |
| |
| # 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-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", |
| "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", |
| "//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/fs-test-utils", |
| "//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/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" |
| |
| # We need some extra system flags that the _ALL_SOURCE define exposes. |
| 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.fs:fuchsia.fs_llcpp", |
| "//sdk/fidl/fuchsia.security.resource:fuchsia.security.resource_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" ] |
| } |
| |
| isolated_devmgr_unittest_component("blobfs-integration-component") { |
| executable_path = "test/blobfs-integration-test" |
| component_name = "blobfs-integration" |
| |
| # This is required for the Vmex resource to get executable blobs. |
| services = [ "fuchsia.security.resource.Vmex" ] |
| |
| 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/fvm", |
| "//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", |
| ] |
| } |
| |
| test("blobfs-integration-paged-test") { |
| sources = [ |
| "integration/blobfs_integration_paged_main.cc", |
| "integration/launch.cc", |
| ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| ] |
| |
| # TODO(fxbug.dev/58162): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| |
| public_deps = [ ":test-utils-zxtest" ] |
| } |
| |
| isolated_devmgr_unittest_component("blobfs-integration-paged-component") { |
| executable_path = "test/blobfs-integration-paged-test" |
| component_name = "blobfs-integration-paged" |
| services = [ "fuchsia.security.resource.Vmex" ] |
| deps = [ ":blobfs-integration-paged-test" ] |
| } |
| |
| # Creates two components, one regular one that runs the test named with the name |
| # "<target_name>", and on paged one named "<target_name>-paged". The target names will have |
| # "-component" appended to them. |
| template("blobfs_large_integration_test") { |
| test_name = target_name |
| component_name = "${target_name}-component" |
| |
| test(test_name) { |
| output_name = invoker.target_name |
| |
| sources = invoker.sources + [ "integration/large/main.cc" ] |
| |
| include_dirs = [ "integration" ] |
| |
| deps = [ |
| ":integration-fixtures", |
| ":load-generator", |
| ":test-utils-zxtest", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_llcpp", |
| "//sdk/lib/fdio", |
| "//src/storage/blobfs", |
| "//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/fdio-caller", |
| "//zircon/system/ulib/fs-test-utils", |
| "//zircon/system/ulib/fs/test_support", |
| "//zircon/system/ulib/fvm", |
| "//zircon/system/ulib/memfs", |
| ] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| } |
| |
| paged_test_name = "${target_name}-paged" |
| paged_component_name = "${paged_test_name}-component" |
| |
| test(paged_test_name) { |
| sources = [ |
| "integration/large/paged_main.cc", |
| "integration/launch.cc", |
| ] |
| |
| defines = [ "BLOBFS_LARGE_INTEGRATION_TEST_EXECUTABLE=\"$test_name\"" ] |
| include_dirs = [ "integration" ] |
| |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| isolated_devmgr_unittest_component(component_name) { |
| executable_path = "test/$test_name" |
| component_name = test_name |
| |
| # TODO(bug 59859) "SysInfo" service should no longer be needed when the board querying code is |
| # removed and this line can be deleted. |
| services = [ "fuchsia.sysinfo.SysInfo" ] |
| deps = [ ":$test_name" ] |
| } |
| |
| isolated_devmgr_unittest_component(paged_component_name) { |
| executable_path = "test/$paged_test_name" |
| component_name = paged_test_name |
| |
| # TODO(bug 59859) "SysInfo" service should no longer be needed when the board querying code is |
| # removed and this line can be deleted. |
| services = [ "fuchsia.sysinfo.SysInfo" ] |
| deps = [ ":$paged_test_name" ] |
| } |
| } |
| |
| # :blobfs-fragmentation-component -> blobfs-fragmentation.cmx |
| # :blobfs-fragmentation-paged-component -> blobfs-fragmentation-paged.cmx |
| blobfs_large_integration_test("blobfs-fragmentation") { |
| sources = [ "integration/large/fragmentation.cc" ] |
| } |
| |
| # :blobfs-max-reservation-component -> blobfs-max-reservation.cmx |
| # :blobfs-max-reservation-paged-component -> blobfs-max-reservation-paged.cmx |
| blobfs_large_integration_test("blobfs-max-reservation") { |
| sources = [ "integration/large/max-reservation.cc" ] |
| } |
| |
| # :blobfs-no-space-component -> blobfs-no-space.cmx |
| # :blobfs-no-space-paged-component -> blobfs-no-space-paged.cmx |
| blobfs_large_integration_test("blobfs-no-space") { |
| sources = [ "integration/large/no-space.cc" ] |
| } |
| |
| # :blobfs-use-second-bitmap-component -> blobfs-use-second-bitmap.cmx |
| # :blobfs-use-second-bitmap-paged-component -> blobfs-use-second-bitmap-paged.cmx |
| 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-fragmentation-paged-component", |
| ":blobfs-integration-component", |
| ":blobfs-integration-paged-component", |
| ":blobfs-max-reservation-component", |
| ":blobfs-max-reservation-paged-component", |
| ":blobfs-no-space-component", |
| ":blobfs-no-space-paged-component", |
| ":blobfs-use-second-bitmap-component", |
| ":blobfs-use-second-bitmap-paged-component", |
| ] |
| } |
| |
| 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" ] |
| } |
| |
| fuzzer("zstd-fuzzer") { |
| sources = [ "zstd-fuzzer.cc" ] |
| deps = [ |
| "//src/storage/blobfs", |
| "//src/storage/blobfs:private_headers", |
| |
| # 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", |
| "//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(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", |
| "//src/storage/blobfs:private_headers", |
| |
| # 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", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/fs-test-utils", |
| ] |
| } |