blob: a54221933658d86edc670f4ad282f8317b797069 [file] [log] [blame]
# 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-integration-package",
":blobfs-unittest",
":blobfs_host($host_toolchain)",
"//src/lib/isolated_devmgr/v2_component",
]
}
executable("test_binary") {
testonly = true
sources = [ "test_binary_main.cc" ]
visibility = [ ":*" ]
}
resource("test_binary_resource") {
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",
"//src/lib/digest",
"//third_party/googletest:gtest",
"//zircon/public/lib/fbl",
]
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_inspector_test.cc",
"unit/blobfs_pager_test.cc",
"unit/blobfs_revision_test.cc",
"unit/blobfs_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",
"//third_party/zstd:zstdseek",
"//zircon/public/lib/cksum",
"//zircon/public/lib/lz4",
"//zircon/public/lib/safemath",
"//zircon/public/lib/sync",
"//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/cobalt-client:in-memory-logger",
"//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_resource",
]
}
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 = [
":test_utils",
"//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",
"//third_party/googletest:gtest",
"//third_party/zstd",
"//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/fs-management",
"//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_resource",
]
}
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/health_check_test.cc",
"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/fs-management",
"//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/fs-management",
"//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",
"//third_party/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",
"//third_party/zstd:zstdseek",
]
}
fuzzer("zstd-seekable-fuzzer") {
sources = [ "zstd_seekable_fuzzer.cc" ]
deps = [
"//src/storage/blobfs",
"//third_party/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",
]
}