| # Copyright 2022 The Fuchsia Authors |
| # |
| # Use of this source code is governed by a MIT-style |
| # license that can be found in the LICENSE file or at |
| # https://opensource.org/licenses/MIT |
| |
| import("//build/testing/boot_tests/boot_test.gni") |
| import("//build/testing/environments.gni") |
| import("efi_executable.gni") |
| import("toolchain.gni") |
| |
| # UEFI testing is only available to emulators at this time. |
| all_uefi_envs = [ qemu_env ] |
| if (current_cpu != "riscv64") { |
| all_uefi_envs += [ aemu_env ] |
| } |
| |
| # Defines a UEFI test application. |
| # |
| # Subtargets |
| # |
| # * $target_name.executable |
| # - The associated efi_executable() target. |
| # |
| # * $target_name.fatfs |
| # - The associated fat_filesystem() target. |
| # |
| # Parameters |
| # |
| # * data_deps |
| # - Optional: `resource()`s that should present in the UEFI application's |
| # local filesystem at runtime. |
| # - Type: list(label) |
| # |
| # * disabled |
| # - Optional: See boot_test(). |
| # - Type: bool |
| # - Default: false |
| # |
| # * environments |
| # - Optional: See boot_test(). |
| # - Type: list(scope) |
| # - Default: all_uefi_envs |
| # |
| # See efi_executable() for other parameters. |
| # |
| template("efi_test") { |
| executable_target = "$target_name.executable" |
| main_target = target_name |
| |
| efi_label = get_label_info(":$executable_target($efi_toolchain)", |
| "label_with_toolchain") |
| efi_executable(executable_target) { |
| testonly = true |
| |
| # By default, this ensures that UEFI recognizes the filesystem image as a |
| # boot option that boots this executable. |
| install_path = "efi/boot/boot${efi_cpu}.efi" |
| |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "disabled", |
| "environments", |
| "testonly", |
| ]) |
| if (defined(visibility)) { |
| visibility += [ ":$main_target" ] |
| } |
| if (!defined(output_name)) { |
| output_name = main_target |
| } |
| |
| metadata = { |
| images_barrier = [] |
| images = [ |
| { |
| label = efi_label |
| name = output_name |
| path = rebase_path("$root_out_dir/$output_name.efi", root_build_dir) |
| type = "kernel" |
| cpu = current_cpu |
| testonly = true |
| }, |
| ] |
| } |
| } |
| |
| boot_test(main_target) { |
| forward_variables_from(invoker, |
| [ |
| "disabled", |
| "environments", |
| "visibility", |
| ]) |
| if (!defined(environments)) { |
| environments = all_uefi_envs |
| } |
| qemu_kernel = efi_label |
| } |
| } |