| # Copyright 2020 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/toolchain/toolchain_environment.gni") |
| import("//build/zircon/zx_library.gni") |
| |
| # Generic parts of acpi_lite. |
| zx_library("acpi_lite") { |
| sdk = "source" |
| sdk_headers = [ |
| "lib/acpi_lite.h", |
| "lib/acpi_lite/numa.h", |
| "lib/acpi_lite/apic.h", |
| "lib/acpi_lite/debug_port.h", |
| "lib/acpi_lite/internal.h", |
| "lib/acpi_lite/structures.h", |
| ] |
| |
| sources = [ |
| "acpi_lite.cc", |
| "apic.cc", |
| "debug_port.cc", |
| "numa.cc", |
| "structures.cc", |
| "test_data.cc", |
| ] |
| |
| deps = [ "//zircon/system/ulib/pretty" ] |
| |
| public_deps = [ |
| "//sdk/lib/stdcompat", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| # Zircon-specific parts of acpi_lite. |
| if (toolchain_environment == "kernel") { |
| sdk_headers += [ "lib/acpi_lite/zircon.h" ] |
| sources += [ |
| "zircon.cc", |
| |
| # TODO: These should be test-only. |
| "zircon_test.cc", |
| ] |
| deps += [ "//zircon/kernel/lib/unittest" ] |
| } |
| |
| # These bits are needed for both Zircon proper and phys environments. |
| if (is_kernel) { |
| deps += [ |
| "//zircon/kernel/lib/ktl", |
| "//zircon/kernel/lib/libc", |
| ] |
| } |
| } |
| |
| if (!is_kernel) { |
| import("//build/components.gni") |
| import("//build/fuzz.gni") |
| import("//build/test.gni") |
| |
| test("acpi_lite_test") { |
| sources = [ |
| "acpi_lite_test.cc", |
| "apic_test.cc", |
| "binary_reader_test.cc", |
| "debug_port_test.cc", |
| "numa_test.cc", |
| ] |
| deps = [ |
| ":acpi_lite", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("acpi-lite-test") { |
| deps = [ ":acpi_lite_test" ] |
| } |
| |
| fuchsia_library_fuzzer("acpi_lite_fuzztest") { |
| sources = [ "acpi_lite_fuzztest.cc" ] |
| deps = [ ":acpi_lite" ] |
| } |
| |
| fuchsia_library_fuzzer("apic_fuzztest") { |
| sources = [ "apic_fuzztest.cc" ] |
| deps = [ ":acpi_lite" ] |
| } |
| |
| fuchsia_library_fuzzer("numa_fuzztest") { |
| sources = [ "numa_fuzztest.cc" ] |
| deps = [ ":acpi_lite" ] |
| } |
| |
| fuchsia_library_fuzzer("debug_port_fuzztest") { |
| sources = [ "debug_port_fuzztest.cc" ] |
| deps = [ ":acpi_lite" ] |
| } |
| |
| fuchsia_fuzzer_component("acpi-lite-fuzztest-component") { |
| manifest = "meta/acpi_lite_fuzztest.cml" |
| deps = [ ":acpi_lite_fuzztest" ] |
| } |
| |
| fuchsia_fuzzer_component("apic-fuzztest-component") { |
| manifest = "meta/apic_fuzztest.cml" |
| deps = [ ":apic_fuzztest" ] |
| } |
| |
| fuchsia_fuzzer_component("numa-fuzztest-component") { |
| manifest = "meta/numa_fuzztest.cml" |
| deps = [ ":numa_fuzztest" ] |
| } |
| |
| fuchsia_fuzzer_component("debug-port-fuzztest-component") { |
| manifest = "meta/debug_port_fuzztest.cml" |
| deps = [ ":debug_port_fuzztest" ] |
| } |
| |
| fuchsia_fuzzer_package("acpi-lite-fuzzer") { |
| cpp_fuzzer_components = [ |
| ":acpi-lite-fuzztest-component", |
| ":apic-fuzztest-component", |
| ":numa-fuzztest-component", |
| ":debug-port-fuzztest-component", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":acpi-lite-fuzzer", |
| ":acpi-lite-test", |
| ":acpi_lite_test($host_toolchain)", |
| ] |
| } |
| } |