| # 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/driver_test_realm.gni") |
| import("//tools/cmc/build/expect_includes.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":blobfs-integration-package", |
| ":blobfs-large-integration-package", |
| ] |
| } |
| |
| 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") { |
| manifest = "meta/external_decompressor_integration.cml" |
| deps = [ |
| ":external_decompressor_integration", |
| "//src/storage/blobfs:decompressor-sandbox", |
| ] |
| } |
| |
| 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/lib/testing/predicates", |
| "//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") { |
| manifest = "meta/blobfs_integration.cml" |
| deps = [ ":blobfs_integration" ] |
| } |
| |
| 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") { |
| deps = [ ":blobfs_mount" ] |
| } |
| |
| 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") { |
| manifest = "meta/blobfs_component_runner_test.cml" |
| deps = [ |
| ":blobfs_component_runner_test", |
| "//src/storage/blobfs:decompressor-sandbox", |
| ] |
| } |
| |
| 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") { |
| deps = [ ":blobfs_sync" ] |
| } |
| |
| 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") { |
| deps = [ ":blobfs_superblock" ] |
| } |
| |
| 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") { |
| deps = [ ":ota_health_check_service" ] |
| } |
| |
| 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_unittest_component("executable-mount") { |
| manifest = "meta/executable_mount_test.cml" |
| deps = [ |
| ":executable_mount", |
| "//src/storage/blobfs:decompressor-sandbox", |
| ] |
| 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") { |
| deps = [ ":blob-creator-test-bin" ] |
| } |
| |
| template("blobfs_large_integration_test") { |
| test_name = target_name |
| bin_name = "${test_name}-bin" |
| component_name = "${target_name}" |
| |
| 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" ] |
| } |
| } |
| |
| blobfs_large_integration_test("blobfs-fragmentation") { |
| sources = [ "large/fragmentation.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-max-reservation") { |
| sources = [ "large/max_reservation.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-no-space") { |
| sources = [ "large/no_space.cc" ] |
| } |
| |
| blobfs_large_integration_test("blobfs-use-second-bitmap") { |
| sources = [ "large/use_second_bitmap.cc" ] |
| } |
| |
| 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 = [ |
| "//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 = [ |
| "//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" ] |
| } |
| } |