| # Copyright 2022 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. |
| |
| load( |
| "@fuchsia_sdk//fuchsia:assembly.bzl", |
| "PARTITION_TYPE", |
| "SLOT", |
| "fuchsia_assemble_package", |
| "fuchsia_board_configuration", |
| "fuchsia_board_input_bundle", |
| "fuchsia_bootloader_partition", |
| "fuchsia_bootstrap_partition", |
| "fuchsia_partition", |
| "fuchsia_partitions_configuration", |
| "fuchsia_prebuilt_board_input_bundle", |
| "fuchsia_prebuilt_package", |
| "fuchsia_prebuilt_product_configuration", |
| "fuchsia_product_configuration", |
| "fuchsia_product_ota_config", |
| "fuchsia_virtual_device", |
| "ota_realm", |
| "tuf_repo", |
| "tuf_repo_root", |
| ) |
| load(":fuchsia_board_configuration_test.bzl", "fuchsia_board_configuration_test") |
| load(":fuchsia_board_input_bundle_test.bzl", "fuchsia_board_input_bundle_test") |
| load(":fuchsia_partitions_configuration_test.bzl", "fuchsia_partitions_configuration_test") |
| load(":fuchsia_product_configuration_test.bzl", "fuchsia_product_configuration_test", "fuchsia_product_ota_config_test") |
| load(":fuchsia_virtual_device_test.bzl", "fuchsia_virtual_device_test") |
| |
| fuchsia_prebuilt_package( |
| name = "prebuilt_ams_light", |
| archive = ":test_data/ams-light-test-0.far", |
| ) |
| |
| fuchsia_prebuilt_package( |
| name = "prebuilt_driver", |
| archive = ":test_data/backlight_driver.far", |
| drivers = [ |
| "meta/backlight_driver.cm", |
| ], |
| ) |
| |
| fuchsia_board_input_bundle( |
| name = "testing_board_input_bundle", |
| base_packages = [ |
| ":prebuilt_ams_light", |
| ], |
| bootfs_driver_packages = [ |
| ":prebuilt_driver", |
| ], |
| cpu_manager_config = "test_data/config_data.json", |
| ) |
| |
| fuchsia_prebuilt_board_input_bundle( |
| name = "testing_prebuilt_board_input_bundle", |
| config = "test_data/board_input_bundle.json", |
| ) |
| |
| fuchsia_board_input_bundle_test( |
| name = "board_input_bundle_golden_test", |
| board_input_bundle = ":testing_board_input_bundle", |
| golden_file = ":test_data/board_input_bundle_golden_file.json", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_board_configuration( |
| name = "testing_board_configuration", |
| board_input_bundles = [ |
| ":testing_board_input_bundle", |
| ":testing_prebuilt_board_input_bundle", |
| ], |
| board_name = "x64", |
| devicetree = "test_data/test.dtb", |
| ) |
| |
| fuchsia_board_configuration_test( |
| name = "board_configuration_golden_test", |
| board_config = ":testing_board_configuration", |
| golden_file = select({ |
| "@fuchsia_sdk//fuchsia/constraints:cpu_arm64": ":test_data/board_configuration_golden_file_arm64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_x64": ":test_data/board_configuration_golden_file_x64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_riscv64": ":test_data/board_configuration_golden_file_riscv64.json", |
| }), |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_assemble_package( |
| name = "assembled_ams_light", |
| configs = { |
| ":test_data/config_data.json": "config_data.json", |
| }, |
| package = ":prebuilt_ams_light", |
| ) |
| |
| # buildifier: leave-alone |
| fuchsia_product_configuration( |
| name = "testing_product_config", |
| |
| # Product configuration items |
| base_packages = [ |
| ":assembled_ams_light", |
| ], |
| cache_packages = [ |
| ":prebuilt_ams_light", |
| ], |
| base_driver_packages = [ |
| ":prebuilt_driver", |
| ], |
| product_config_json = { |
| "platform": { |
| "build_type": "user", |
| "connectivity": {"wlan": { |
| "legacy_privacy_support": True, |
| }}, |
| "development_support": {"enabled": True}, |
| "diagnostics": { |
| "archivist": "default", |
| "additional_serial_log_components": [ |
| "/core/session-manager", |
| "/core/session-manager/session:session", |
| ], |
| }, |
| "identity": {"password_pinweaver": "required"}, |
| "ui": {"supported_input_devices": [ |
| "button", |
| "keyboard", |
| ]}, |
| "some": {"random": { |
| "path1": True, |
| "int1": 3234234324231434134141234, |
| "string1": "I have a string", |
| }}, |
| "another": {"random": { |
| "path1": False, |
| "int": 0, |
| "string2": "false", |
| }}, |
| }, |
| "product": { |
| "session_url": "fuchsia-pkg://fuchsia.com/test_session#meta/test_session.cm", |
| }, |
| }, |
| ) |
| |
| fuchsia_product_configuration_test( |
| name = "product_config_golden_test", |
| # Unfortunately, the golden file contains paths that depend on the target |
| # build configuration (e.g. x86_64-fastbuild/... for x64 builds, and |
| # aarch64-fastbuild/... for arm64 ones), so different golden files need |
| # to be provided. |
| golden_file = select({ |
| "@fuchsia_sdk//fuchsia/constraints:cpu_arm64": ":test_data/product_config_golden_file_arm64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_x64": ":test_data/product_config_golden_file_x64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_riscv64": ":test_data/product_config_golden_file_riscv64.json", |
| }), |
| product_config = ":testing_product_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_product_configuration( |
| name = "testing_product_config_with_labels", |
| product_config_json = { |
| "platform": { |
| "foo": "LABEL(test_data/foo.txt)", |
| }, |
| "product": { |
| "bar": "LABEL(test_data/bar.txt)", |
| }, |
| }, |
| ) |
| |
| fuchsia_prebuilt_product_configuration( |
| name = "prebuilt_product_config", |
| build_type = "userdebug", |
| product_config_dir = "test_data/prebuilt_product_config", |
| product_config_filename = "prebuilt_product_config.json", |
| ) |
| |
| fuchsia_product_configuration_test( |
| name = "product_config_with_labels_golden_test", |
| golden_file = ":test_data/product_config_with_labels_golden_file.json", |
| product_config = ":testing_product_config_with_labels", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_product_configuration_test( |
| name = "prebuilt_product_config_golden_test", |
| golden_file = ":test_data/prebuilt_product_config_golden.json", |
| product_config = ":prebuilt_product_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_bootstrap_partition( |
| name = "bootstrap_partition_3728", |
| condition_value = "0xe9000000", |
| condition_variable = "emmc-total-bytes", |
| image = ":test_data/gpt.fuchsia.3728.bin", |
| partition_name = "gpt", |
| ) |
| |
| fuchsia_bootstrap_partition( |
| name = "bootstrap_partition_3776", |
| condition_value = "0xe9000000", |
| condition_variable = "emmc-total-bytes", |
| image = ":test_data/gpt.fuchsia.3776.bin", |
| partition_name = "gpt", |
| ) |
| |
| fuchsia_bootloader_partition( |
| name = "my_bootloader_partition", |
| image = ":test_data/u-boot.bin.signed.test-b4", |
| partition_name = "bootloader", |
| type = "skip_metadata", |
| ) |
| |
| fuchsia_partition( |
| name = "zbi_partition", |
| partition_name = "zircon_a", |
| slot = SLOT.A, |
| type = PARTITION_TYPE.ZBI, |
| ) |
| |
| fuchsia_partition( |
| name = "vbmeta_partition", |
| partition_name = "vbmeta_b", |
| slot = SLOT.B, |
| type = PARTITION_TYPE.VBMETA, |
| ) |
| |
| fuchsia_partition( |
| name = "fvm_partition", |
| partition_name = "fvm", |
| type = PARTITION_TYPE.FVM, |
| ) |
| |
| fuchsia_partitions_configuration( |
| name = "my_partitions_config", |
| bootloader_partitions = [ |
| ":my_bootloader_partition", |
| ], |
| bootstrap_partitions = [ |
| ":bootstrap_partition_3776", |
| ":bootstrap_partition_3728", |
| ], |
| hardware_revision = "workstation", |
| partitions = [ |
| ":zbi_partition", |
| ":vbmeta_partition", |
| ":fvm_partition", |
| ], |
| unlock_credentials = [ |
| ":test_data/unlock-creds.zip", |
| ], |
| ) |
| |
| fuchsia_partitions_configuration_test( |
| name = "partitions_config_golden_test", |
| golden_file = ":test_data/partitions_config_golden_file.json", |
| partitions_config = ":my_partitions_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_virtual_device( |
| name = "my_virtual_device", |
| arch = "x64", |
| device_name = "test", |
| memory_quantity = 16, |
| memory_unit = "gigabytes", |
| storage_quantity = 8, |
| storage_unit = "terabytes", |
| window_height_px = 2160, |
| window_width_px = 3840, |
| ) |
| |
| fuchsia_virtual_device_test( |
| name = "virtual_device_golden_test", |
| golden_file = ":test_data/virtual_device_golden_file.json", |
| virtual_device = ":my_virtual_device", |
| visibility = ["//visibility:public"], |
| ) |
| |
| test_ota_realm_a = ota_realm( |
| name = "test_realm_a", |
| app_id = "some_app_id_a", |
| channels = [ |
| "channel_a", |
| "channel_b", |
| "channel_c", |
| "channel_d", |
| ], |
| tuf = tuf_repo( |
| hostnames = |
| ["some.hostname.com"], |
| mirror_url = "https://some.hostname.com", |
| root = tuf_repo_root( |
| signing_threshold = 1, |
| type = "ed25519", |
| value = |
| "0000000000000000000000000000000000000000000000000000000000000000", |
| version = 4, |
| ), |
| ), |
| ) |
| |
| test_ota_realm_b = ota_realm( |
| name = "test_realm_b", |
| app_id = "some_app_id_b", |
| channels = [ |
| "channel_e", |
| "channel_f", |
| "channel_g", |
| "channel_h", |
| ], |
| tuf = tuf_repo( |
| hostnames = |
| ["some.other_hostname.com"], |
| mirror_url = "https://some.other_hostname.com", |
| root = tuf_repo_root( |
| signing_threshold = 1, |
| type = "ed25519", |
| value = |
| "0000000000000000000000000000000000000000000000000000000000000000", |
| version = 4, |
| ), |
| ), |
| ) |
| |
| fuchsia_product_ota_config( |
| name = "test_ota_config", |
| default_channel = "channel_b", |
| realms = [ |
| test_ota_realm_a, |
| test_ota_realm_b, |
| ], |
| ) |
| |
| fuchsia_product_configuration( |
| name = "test_product_configuration_with_ota_config", |
| ota_configuration = ":test_ota_config", |
| product_config_json = { |
| "platform": { |
| "build_type": "userdebug", |
| }, |
| }, |
| ) |
| |
| fuchsia_product_configuration_test( |
| name = "product_ota_config_golden_test", |
| golden_file = select({ |
| "@fuchsia_sdk//fuchsia/constraints:cpu_arm64": ":test_data/product_config_with_ota_golden_file_arm64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_x64": ":test_data/product_config_with_ota_golden_file_x64.json", |
| "@fuchsia_sdk//fuchsia/constraints:cpu_riscv64": ":test_data/product_config_with_ota_golden_file_riscv64.json", |
| }), |
| product_config = ":test_product_configuration_with_ota_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_product_ota_config_test( |
| name = "product_ota_config_golden_test_channel_config", |
| golden_file = ":test_data/channel_config.json", |
| product_config = ":test_product_configuration_with_ota_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_product_ota_config_test( |
| name = "product_ota_config_golden_test_realm_a_tuf_repo", |
| golden_file = ":test_data/some.hostname.com.json", |
| product_config = ":test_product_configuration_with_ota_config", |
| visibility = ["//visibility:public"], |
| ) |
| |
| fuchsia_product_ota_config_test( |
| name = "product_ota_config_golden_test_realm_b_tuf_repo", |
| golden_file = ":test_data/some.other_hostname.com.json", |
| product_config = ":test_product_configuration_with_ota_config", |
| visibility = ["//visibility:public"], |
| ) |