blob: 3578c1487fd3502aa1e4f3f2751cdf63309955c6 [file] [log] [blame] [edit]
# Copyright 2021 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/test.gni")
import("//src/storage/testing/decompressor_wrapper.gni")
import("//src/storage/testing/driver_test_realm.gni")
import("//tools/cmc/build/expect_includes.gni")
group("tests") {
testonly = true
deps = [
":blobfs-integration-package",
":blobfs-large-integration-package",
]
}
expect_includes("decompressor_includes") {
includes = [ "meta/decompressor.shard.cml" ]
}
static_library("blobfs_integration_fixtures") {
testonly = true
public = [
"blobfs_fixtures.h",
"fdio_test.h",
]
sources = [
"blobfs_fixtures.cc",
"fdio_test.cc",
]
deps = [
"//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_cpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/diagnostics/reader/cpp:archive_reader",
"//sdk/lib/fdio",
"//sdk/lib/sys/cpp",
"//src/storage/lib/fs_management",
"//zircon/system/ulib/fdio-caller",
]
public_deps = [
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/inspect/component/cpp",
"//src/storage/blobfs",
"//src/storage/blobfs/test:test_utils",
"//src/storage/fs_test",
"//third_party/googletest:gtest",
"//zircon/system/ulib/fbl",
]
}
test("external_decompressor_integration") {
sources = [ "external_decompressor_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/blobfs/test:test_utils",
"//third_party/googletest:gtest",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/zx",
]
}
fuchsia_unittest_component("external-decompressor-integration") {
manifest = "meta/external_decompressor_integration.cml"
deps = [ ":external_decompressor_integration" ]
}
wrap_with_decompressor("external-decompressor") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/external-decompressor-integration.cm"
forwarded_protocols = [
"fuchsia.diagnostics.ArchiveAccessor",
"fuchsia.inspect.InspectSink",
"fuchsia.logger.LogSink",
]
}
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 = [
"blobfs_integration_test.cc",
"delivery_blob_integration_test.cc",
"multithreaded_smoke_test.cc",
]
deps = [
":blobfs_integration_fixtures",
"//sdk/fidl/fuchsia.fs:fuchsia.fs_cpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/fdio",
"//sdk/lib/inspect/testing/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/fs_test",
"//src/storage/fvm",
"//src/storage/lib/block_client/cpp",
"//src/storage/lib/block_client/cpp:fake_device",
"//src/storage/lib/fs_management",
"//src/storage/lib/utils:topological_path",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/zx",
"//zircon/third_party/ulib/safemath",
]
}
storage_driver_test_realm_v2_component("blobfs-integration-component") {
manifest = "meta/blobfs_integration.cml"
deps = [
":blobfs_integration",
":decompressor_includes",
]
}
wrap_with_decompressor("blobfs-integration") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blobfs-integration-component.cm"
forwarded_protocols = [
"fuchsia.diagnostics.ArchiveAccessor",
"fuchsia.inspect.InspectSink",
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
test("blobfs_mount") {
output_name = "blobfs_mount_test"
# We need some extra system flags that the _ALL_SOURCE define exposes.
configs += [ "//build/config:all_source" ]
sources = [ "mount_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/lib/block_client/cpp:fake_device",
"//src/storage/lib/fs_management",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/zx",
]
}
storage_driver_test_realm_v2_component("blobfs-mount-component") {
deps = [
":blobfs_mount",
":decompressor_includes",
]
}
wrap_with_decompressor("blobfs-mount") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blobfs-mount-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
test("blobfs_component_runner_test") {
output_name = "blobfs_component_runner_test"
sources = [ "blobfs_component_runner_test.cc" ]
deps = [
"//sdk/fidl/fuchsia.fs:fuchsia.fs_cpp",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/lib/block_client/cpp:fake_device",
"//zircon/system/ulib/id_allocator",
"//zircon/system/ulib/zx",
]
}
fuchsia_unittest_component("blobfs-component-runner-test-component") {
manifest = "meta/blobfs_component_runner_test.cml"
deps = [ ":blobfs_component_runner_test" ]
}
wrap_with_decompressor("blobfs-component-runner-test") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blobfs-component-runner-test-component.cm"
}
test("blobfs_sync") {
output_name = "blobfs_sync_test"
# We need some extra system flags that the _ALL_SOURCE define exposes.
configs += [ "//build/config:all_source" ]
sources = [ "sync_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/lib/block_client/cpp:fake_device",
"//src/storage/lib/fs_management",
]
}
storage_driver_test_realm_v2_component("blobfs-sync-component") {
deps = [
":blobfs_sync",
":decompressor_includes",
]
}
wrap_with_decompressor("blobfs-sync") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blobfs-sync-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
test("blobfs_superblock") {
output_name = "blobfs_superblock_test"
# We need some extra system flags that the _ALL_SOURCE define exposes.
configs += [ "//build/config:all_source" ]
sources = [ "superblock_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/lib/component/incoming/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/lib/block_client/cpp",
"//zircon/system/ulib/fbl",
]
}
storage_driver_test_realm_v2_component("blobfs-superblock-component") {
deps = [
":blobfs_superblock",
":decompressor_includes",
]
}
wrap_with_decompressor("blobfs-superblock") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blobfs-superblock-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
test("ota_health_check_service") {
output_name = "ota_health_check_service_test"
# We need some extra system flags that the _ALL_SOURCE define exposes.
configs += [ "//build/config:all_source" ]
sources = [ "component_ota_health_check_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/fidl/fuchsia.update:fuchsia.update_cpp",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//zircon/system/ulib/zx",
]
}
storage_driver_test_realm_v2_component("ota-health-check-service-component") {
deps = [
":decompressor_includes",
":ota_health_check_service",
]
}
wrap_with_decompressor("ota-health-check-service") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/ota-health-check-service-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
test("executable_mount") {
testonly = true
sources = [ "executable_mount_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/fidl/fuchsia.kernel:fuchsia.kernel_cpp",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/storage/lib/fs_management",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/id_allocator",
]
}
fuchsia_component("executable-mount-component") {
testonly = true
manifest = "meta/executable_mount_test.cml"
deps = [ ":executable_mount" ]
}
wrap_with_decompressor("executable-mount") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/executable-mount-component.cm"
forwarded_protocols = [
"fuchsia.kernel.VmexResource",
"fuchsia.logger.LogSink",
]
test_type = "system"
}
test("blob-creator-test-bin") {
sources = [ "blob_creator_test.cc" ]
deps = [
":blobfs_integration_fixtures",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/fidl/cpp/wire",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/predicates",
"//src/storage/blobfs",
"//src/storage/fxfs/fidl/fuchsia.fxfs:fuchsia.fxfs_cpp",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/zx",
]
}
storage_driver_test_realm_v2_component("blob-creator-test-component") {
deps = [
":blob-creator-test-bin",
":decompressor_includes",
]
}
wrap_with_decompressor("blob-creator-test") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-integration#meta/blob-creator-test-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
template("blobfs_large_integration_test") {
test_name = target_name
bin_name = "${test_name}-bin"
component_name = "${target_name}-component"
test(bin_name) {
output_name = invoker.target_name
sources = invoker.sources
deps = [
":blobfs_integration_fixtures",
"//sdk/fidl/fuchsia.io:fuchsia.io_cpp",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/storage/blobfs",
"//src/storage/blobfs/test:test_utils",
"//src/storage/fs_test",
"//src/storage/fvm",
"//third_party/googletest:gtest",
"//zircon/system/ulib/fdio-caller",
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
}
storage_driver_test_realm_v2_component(component_name) {
deps = [
":$bin_name",
":decompressor_includes",
]
}
}
blobfs_large_integration_test("blobfs-fragmentation") {
sources = [ "large/fragmentation.cc" ]
}
wrap_with_decompressor("blobfs-fragmentation") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-large-integration#meta/blobfs-fragmentation-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
blobfs_large_integration_test("blobfs-max-reservation") {
sources = [ "large/max_reservation.cc" ]
}
wrap_with_decompressor("blobfs-max-reservation") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-large-integration#meta/blobfs-max-reservation-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
blobfs_large_integration_test("blobfs-no-space") {
sources = [ "large/no_space.cc" ]
}
wrap_with_decompressor("blobfs-no-space") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-large-integration#meta/blobfs-no-space-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
blobfs_large_integration_test("blobfs-use-second-bitmap") {
sources = [ "large/use_second_bitmap.cc" ]
}
wrap_with_decompressor("blobfs-use-second-bitmap") {
test_url = "fuchsia-pkg://fuchsia.com/blobfs-large-integration#meta/blobfs-use-second-bitmap-component.cm"
forwarded_protocols = [
"fuchsia.logger.LogSink",
"fuchsia.process.Launcher",
]
}
fuchsia_test_package("blobfs-large-integration-package") {
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
package_name = "blobfs-large-integration"
test_components = [
":blobfs-fragmentation",
":blobfs-max-reservation",
":blobfs-no-space",
":blobfs-use-second-bitmap",
]
deps = [
":blobfs-fragmentation-component",
":blobfs-max-reservation-component",
":blobfs-no-space-component",
":blobfs-use-second-bitmap-component",
"//src/storage/blobfs/bin:blobfs-component",
"//src/storage/fvm:fvm-component",
]
}
fuchsia_test_package("blobfs-integration-package") {
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
package_name = "blobfs-integration"
test_components = [
":blob-creator-test",
":blobfs-component-runner-test",
":blobfs-integration",
":blobfs-mount",
":blobfs-sync",
":blobfs-superblock",
":executable-mount",
":external-decompressor",
":ota-health-check-service",
]
deps = [
":blob-creator-test-component",
":blobfs-component-runner-test-component",
":blobfs-integration-component",
":blobfs-mount-component",
":blobfs-superblock-component",
":blobfs-sync-component",
":executable-mount-component",
":external-decompressor-integration",
":ota-health-check-service-component",
"//src/storage/blobfs/bin:blobfs-component",
"//src/storage/fvm:fvm-component",
]
# TODO(b/297201368): These tests timeout on RISC-V builders currently.
if (current_cpu == "riscv64") {
test_components -= [ ":blobfs-integration" ]
}
}