| # Copyright 2019 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/config/zircon/standard.gni") |
| import("//build/testing/boot_tests/kernel_zbi_test.gni") |
| import("//build/zircon/zircon_cpu.gni") |
| import("kernel_shell_script.gni") |
| import("params.gni") |
| |
| declare_args() { |
| # Cause //zircon/kernel:boot_tests to generate the phys boot tests |
| # for all supported CPUs, not just $target_cpu. |
| all_cpu_kernel_boot_tests = false |
| } |
| |
| # TODO(https://fxbug.dev/371568912): Once the dust settles, audit what uses this |
| # target and for what purposes. Eventually, we likely want to get to having no |
| # such target here. |
| group("kernel") { |
| public_deps = [ "image/legacy($default_toolchain)" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| "arch/$zircon_cpu/user-copy:tests", |
| "dev/coresight/tests($host_toolchain)", |
| "lib:tests", |
| "phys:tests", |
| "phys/lib:tests", |
| "tests", |
| "vm/phys:tests", |
| ] |
| |
| if (current_cpu == "x64") { |
| deps += [ "lib/libc/string/arch/x86:tests" ] |
| } |
| |
| # Don't let any test ZBIs roll up into the overall product image. |
| metadata = { |
| zbi_input_barrier = [] |
| } |
| } |
| |
| if (!is_efi_toolchain) { |
| group("boot_tests") { |
| testonly = true |
| deps = [ |
| ":kernel-as-test", |
| ":kernel-unittests-boot-test", |
| ":kernel-unittests-boot-test-bypass-debuglog", |
| "lib:boot_tests", |
| "phys:boot_tests", |
| "tests:boot_tests", |
| ] |
| if (all_cpu_kernel_boot_tests) { |
| foreach(cpu, standard_fuchsia_cpus) { |
| deps += [ ":boot_tests.$cpu" ] |
| } |
| } |
| } |
| |
| # This is just the kernel, so cmdline additions must set kernel.shell.script |
| # or something like that. It's not run in automation. |
| kernel_zbi_test("kernel-as-test") { |
| disabled = true |
| } |
| |
| template("kernel_unittests_boot_test") { |
| kernel_shell_script_test(target_name) { |
| environments = kernel_test_environments |
| deps = [ "//zircon/kernel/image/${default_kernel_test_image}" ] |
| script = [ |
| "ut all", |
| "and ut -r 10 timer", |
| "and ut -r 10 pi", |
| "boot-test-success", |
| "graceful-shutdown", |
| ] |
| deps += invoker.deps |
| } |
| } |
| |
| kernel_unittests_boot_test("kernel-unittests-boot-test") { |
| deps = [] |
| } |
| |
| # In strange failure modes, the bypass-debuglog version may get more useful |
| # logging out than the normal one, though it may also greatly perturb the |
| # timing and hardware interactions of the test. Running both versions in |
| # automation gives the best chance of logs from one of them being helpful. |
| kernel_unittests_boot_test("kernel-unittests-boot-test-bypass-debuglog") { |
| deps = [ ":bypass-debuglog" ] |
| } |
| } |
| |
| kernel_cmdline("bypass-debuglog") { |
| testonly = true |
| args = [ "kernel.bypass-debuglog" ] |
| } |
| |
| foreach(cpu, standard_fuchsia_cpus) { |
| group("boot_tests.$cpu") { |
| testonly = true |
| deps = [ |
| ":kernel-unittests-boot-test($default_test_kernel_switchset)", |
| "phys/test:$cpu", |
| ] |
| } |
| } |