| # Copyright 2019 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/devicetree/args.gni") |
| import("//build/test.gni") |
| import("//build/testing/bootfs_test.gni") |
| import("//tools/cmc/build/expect_includes.gni") |
| |
| expect_includes("device-enumeration-shard") { |
| includes = [ "meta/device-enumeration.shard.cml" ] |
| } |
| |
| source_set("common") { |
| sources = [ |
| "common.cc", |
| "common.h", |
| ] |
| public_deps = [ |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//src/lib/fsl", |
| "//zircon/system/ulib/zxtest", |
| ] |
| deps = [ |
| ":device-enumeration-shard", |
| "//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development_cpp", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| ] |
| } |
| |
| test("device-enumeration") { |
| output_name = "device-enumeration-test" |
| sources = [ |
| "aemu.cc", |
| "aemu.h", |
| "boards/aemu_x64.cc", |
| "boards/astro.cc", |
| "boards/gce_arm64.cc", |
| "boards/nelson.cc", |
| "boards/nuc.cc", |
| "boards/qemu_arm64.cc", |
| "boards/qemu_riscv64.cc", |
| "boards/qemu_x64.cc", |
| "boards/sherlock.cc", |
| "bootfs_main.cc", |
| ] |
| |
| if (devicetree_board_driver) { |
| sources += [ "boards/vim3-devicetree.cc" ] |
| } else { |
| sources += [ "boards/vim3.cc" ] |
| } |
| |
| deps = [ |
| ":common", |
| "//sdk/fidl/fuchsia.acpi.tables:fuchsia.acpi.tables_cpp", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| ] |
| } |
| |
| bootfs_test("device-enumeration-bootfs-test") { |
| name = "device-enumeration-test" |
| deps = [ ":device-enumeration" ] |
| } |
| |
| # Create a board-specific packaged version of the test. |
| # Some of the boards are not available in the env so they are commented out. |
| _boards = [ |
| [ |
| "aemu_x64", |
| { |
| dimensions = { |
| device_type = "AEMU" |
| cpu = "x64" |
| } |
| }, |
| ], |
| [ |
| "astro", |
| astro_env, |
| ], |
| [ |
| "gce_arm64", |
| { |
| dimensions = { |
| device_type = "GCE" |
| cpu = "arm64" |
| } |
| }, |
| ], |
| [ |
| "nelson", |
| nelson_env, |
| ], |
| [ |
| "nuc", |
| nuc_env, |
| ], |
| [ |
| "qemu_arm64", |
| { |
| dimensions = { |
| device_type = "QEMU" |
| cpu = "arm64" |
| } |
| }, |
| ], |
| [ |
| "qemu_riscv64", |
| { |
| dimensions = { |
| device_type = "QEMU" |
| cpu = "riscv64" |
| } |
| }, |
| ], |
| [ |
| "qemu_x64", |
| { |
| dimensions = { |
| device_type = "QEMU" |
| cpu = "x64" |
| } |
| }, |
| ], |
| [ |
| "sherlock", |
| sherlock_env, |
| ], |
| [ |
| "vim3", |
| vim3_env, |
| ], |
| ] |
| |
| config("include_packaged_drivers") { |
| cflags = [ "-Dinclude_packaged_drivers" ] |
| } |
| |
| foreach(board_info, _boards) { |
| board = board_info[0] |
| test_env = { |
| } |
| test_env = board_info[1] |
| test("device-enumeration-test-${board}-bin") { |
| configs += [ ":include_packaged_drivers" ] |
| sources = [ "boards/${board}.cc" ] |
| deps = [ ":common" ] |
| } |
| |
| fuchsia_unittest_package("device-enumeration-test-${board}") { |
| deps = [ ":device-enumeration-test-${board}-bin" ] |
| test_specs = { |
| environments = [ test_env ] |
| } |
| test_type = "device" |
| } |
| } |
| |
| group("device-enumeration-tests") { |
| testonly = true |
| deps = [] |
| foreach(board_info, _boards) { |
| board = board_info[0] |
| deps += [ ":device-enumeration-test-${board}" ] |
| } |
| } |