| # Copyright 2021 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( |
| "@rules_fuchsia//fuchsia:defs.bzl", |
| "fuchsia_package", |
| "fuchsia_unittest_component", |
| ) |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| # List to hold the test binaries, for ease of component creation. |
| _tests = [] |
| |
| filegroup( |
| name = "common_libs", |
| srcs = [ |
| "@fuchsia_sdk//:arch/x64/sysroot/dist/lib/ld.so.1", |
| ], |
| visibility = ["//visibility:public"], |
| ) |
| |
| cc_library( |
| name = "sim_library", |
| srcs = [ |
| "fake-ucode-test.cc", |
| "inspect-host-cmd.cc", |
| "sim-mcc-update.cc", |
| "sim-mvm.cc", |
| "sim-nvm-data.inc", |
| "sim-nvm.cc", |
| "sim-time-event.cc", |
| "sim-trans.cc", |
| "single-ap-test.cc", |
| "tlv-fw-builder.cc", |
| "tlv-fw-builder.h", |
| "wlan-pkt-builder.cc", |
| ], |
| hdrs = [ |
| "fake-ucode-test.h", |
| "inspect-host-cmd.h", |
| "mock-trans.h", |
| "sim-mcc-update.h", |
| "sim-mvm.h", |
| "sim-nvm.h", |
| "sim-time-event.h", |
| "sim-trans.h", |
| "sim.h", |
| "single-ap-test.h", |
| "wlan-pkt-builder.h", |
| "test.h", |
| ], |
| |
| deps = [ |
| ":mock-ddk", |
| "//third_party/iwlwifi:core", |
| "//third_party/iwlwifi/fw:api", |
| "//third_party/iwlwifi/mvm", |
| "//third_party/iwlwifi/pcie", |
| "//third_party/iwlwifi/cfg", |
| "//third_party/iwlwifi/platform:fuchsia_device", |
| "//third_party/iwlwifi/platform:rcu_manager", |
| "//third_party/iwlwifi/platform:platform", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//pkg/async-loop-cpp", |
| "@fuchsia_sdk//pkg/async-loop-default", |
| "@fuchsia_sdk//fidl/fuchsia.hardware.wlan.softmac:fuchsia.hardware.wlan.softmac_banjo_cc", |
| "@fuchsia_sdk//fidl/fuchsia.hardware.wlanphyimpl:fuchsia.hardware.wlanphyimpl_banjo_cc", |
| "@fuchsia_sdk//fidl/fuchsia.wlan.common:fuchsia.wlan.common_banjo_cc", |
| |
| # "//src/devices/testing/fake-bti", |
| # "//src/devices/pci/testing:pci-protocol-fake", |
| # "//src/devices/testing/mock-ddk", |
| # "//zircon/system/public", |
| ], |
| ) |
| |
| cc_library( |
| name = "no_ddk", |
| srcs = [ "no_ddk.cc" ], |
| deps = [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/ddk", |
| ] |
| ) |
| |
| cc_library( |
| name = "mock-ddk", |
| srcs = [ |
| "libdriver-api.cc", |
| "mock-device.cc", |
| ], |
| hdrs = [ "mock-device.h", ], |
| deps = [ |
| "@fuchsia_sdk//pkg/fdio", |
| "@fuchsia_sdk//pkg/ddk", |
| "@fuchsia_sdk//pkg/async", |
| "@fuchsia_sdk//pkg/sync", |
| ], |
| ) |
| |
| cc_library( |
| name = "mock_function", |
| hdrs = [ "mock-function.h", ], |
| deps = [ "@com_google_googletest//:gtest_main", ], |
| ) |
| |
| cc_library( |
| name = "stub_mvm", |
| srcs = [ "stub-mvm.cc" ], |
| hdrs = [ "test.h" ], |
| ) |
| |
| # Dummy code for developer to start a new test. |
| cc_test( |
| name = "dummy_test", |
| size = "small", |
| srcs = [ "dummy-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":no_ddk", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "dummy_test" ] |
| |
| cc_test( |
| name = "driver_inspector_test", |
| size = "small", |
| srcs = [ "driver-inspector-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//pkg/inspect", |
| "//third_party/iwlwifi/platform:driver_inspector", |
| ], |
| ) |
| _tests += [ "driver_inspector_test" ] |
| |
| cc_test( |
| name = "fw_test", |
| size = "small", |
| srcs = [ "fw-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "@com_google_googletest//:gtest_main", |
| "//third_party/iwlwifi:core", |
| "//third_party/iwlwifi/mvm", |
| ], |
| ) |
| _tests += [ "fw_test" ] |
| |
| cc_test( |
| name = "fw_dbg_test", |
| size = "small", |
| srcs = [ "fw-dbg-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "//third_party/iwlwifi/fw", |
| "//third_party/iwlwifi/platform:driver_inspector", |
| "@fuchsia_sdk//pkg/inspect", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "fw_dbg_test" ] |
| |
| cc_test( |
| name = "iwl_phy_db_test", |
| size = "small", |
| srcs = [ "iwl-phy-db-test.cc" ], |
| deps = [ |
| ":stub_mvm", |
| ":no_ddk", |
| "//third_party/iwlwifi:core", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "iwl_phy_db_test" ] |
| |
| cc_test( |
| name = "mac80211_test", |
| size = "small", |
| srcs = [ "mac80211-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":mock_function", |
| "@com_google_googletest//:gtest_main", |
| "//third_party/iwlwifi/mvm", |
| ], |
| ) |
| _tests += [ "mac80211_test" ] |
| |
| cc_test( |
| name = "mac_ctxt_test", |
| size = "small", |
| srcs = [ "mac-ctxt-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "mac_ctxt_test" ] |
| |
| cc_test( |
| name = "mvm_test", |
| size = "small", |
| srcs = [ "mvm-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":mock_function", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "mvm_test" ] |
| |
| cc_test( |
| name = "notif_wait_test", |
| size = "small", |
| srcs = [ "notif-wait-test.cc" ], |
| deps = [ |
| ":stub_mvm", |
| ":no_ddk", |
| "//third_party/iwlwifi/fw", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "notif_wait_test" ] |
| |
| cc_test( |
| name = "nvm_test", |
| size = "small", |
| srcs = [ "nvm-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "//third_party/iwlwifi:core", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "nvm_test" ] |
| |
| cc_test( |
| name = "pcie_test", |
| size = "small", |
| srcs = [ "pcie-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":mock-ddk", |
| ":mock_function", |
| "//third_party/iwlwifi:core", |
| "//third_party/iwlwifi/fw:api", |
| "//third_party/iwlwifi/pcie", |
| "//third_party/iwlwifi/platform:fuchsia_device", |
| "@fuchsia_sdk//pkg/async-loop-cpp", |
| "@fuchsia_sdk//pkg/async-loop-default", |
| "@fuchsia_sdk//pkg/sync", |
| "@com_google_googletest//:gtest_main", |
| |
| #"//src/devices/pci/testing:pci-protocol-fake", |
| #"//src/devices/testing/fake-bti", |
| ], |
| ) |
| _tests += [ "pcie_test" ] |
| |
| cc_test( |
| name = "phy_ctxt_test", |
| size = "small", |
| srcs = [ "phy-ctxt-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "phy_ctxt_test" ] |
| |
| cc_test( |
| name = "platform_test", |
| size = "small", |
| srcs = [ "platform-test.cc" ], |
| deps = [ |
| ":stub_mvm", |
| ":no_ddk", |
| "//third_party/iwlwifi/platform", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "platform_test" ] |
| |
| cc_test( |
| name = "rcu_manager_test", |
| size = "small", |
| srcs = [ "rcu-manager-test.cc" ], |
| deps = [ |
| "//third_party/iwlwifi/platform:rcu_manager", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//pkg/async", |
| "@fuchsia_sdk//pkg/sync", |
| |
| #"//zircon/system/ulib/async-testing", |
| ], |
| ) |
| _tests += [ "rcu_manager_test" ] |
| |
| cc_test( |
| name = "sta_test", |
| size = "small", |
| srcs = [ "sta-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":mock_function", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "sta_test" ] |
| |
| cc_test( |
| name = "task_test", |
| size = "small", |
| srcs = [ "task-test.cc" ], |
| deps = [ |
| ":stub_mvm", |
| ":no_ddk", |
| "//third_party/iwlwifi/platform", |
| "@com_google_googletest//:gtest_main", |
| |
| #"//zircon/system/ulib/async-testing", |
| ], |
| ) |
| _tests += [ "task_test" ] |
| |
| cc_test( |
| name = "utils_test", |
| size = "small", |
| srcs = [ "utils-test.cc" ], |
| deps = [ |
| ":no_ddk", |
| "//third_party/iwlwifi/mvm", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "utils_test" ] |
| |
| cc_test( |
| name = "wlan_softmac_device_test", |
| size = "small", |
| srcs = [ "wlan-softmac-device-test.cc" ], |
| deps = [ |
| ":sim_library", |
| ":mock_function", |
| "//third_party/iwlwifi/mvm", |
| "//third_party/iwlwifi:core", |
| "//third_party/iwlwifi/platform:fuchsia_device", |
| "@com_google_googletest//:gtest_main", |
| "@fuchsia_sdk//fidl/fuchsia.hardware.wlan.softmac:fuchsia.hardware.wlan.softmac_banjo_cc", |
| "@fuchsia_sdk//fidl/fuchsia.hardware.wlan.associnfo:fuchsia.hardware.wlan.associnfo_banjo_cc", |
| "@fuchsia_sdk//fidl/fuchsia.wlan.ieee80211:fuchsia.wlan.ieee80211_cc", |
| ], |
| ) |
| _tests += [ "wlan_softmac_device_test" ] |
| |
| |
| cc_test( |
| name = "wlanphy_impl_device_test", |
| size = "small", |
| srcs = [ "wlanphy-impl-device-test.cc" ], |
| deps = [ |
| ":sim_library", |
| "//third_party/iwlwifi/mvm", |
| "//third_party/iwlwifi/platform:fuchsia_device", |
| "@fuchsia_sdk//fidl/fuchsia.wlan.common:fuchsia.wlan.common_banjo_cc", |
| "@fuchsia_sdk//fidl/fuchsia.wlan.internal:fuchsia.wlan.internal_banjo_cc", |
| "@com_google_googletest//:gtest_main", |
| ], |
| ) |
| _tests += [ "wlanphy_impl_device_test" ] |
| |
| |
| |
| # Create component for all the test binaries |
| [fuchsia_unittest_component( |
| name = tname + "_component", |
| test_name = tname, |
| deps = [ |
| ":common_libs", |
| ":" + tname, |
| "@fuchsia_clang//:dist", |
| "@fuchsia_sdk//pkg/fdio", |
| ], |
| ) for tname in _tests] |
| |
| fuchsia_package( |
| name = "iwlwifi_test_pkg", |
| package_name = "iwlwifi_test_pkg", |
| testonly = True, |
| visibility = ["//visibility:public"], |
| # How to auto genrate this dep list? |
| deps = [ |
| ":dummy_test_component", |
| ":driver_inspector_test_component", |
| ":fw_test_component", # Doesn't work, some issue in paging. |
| ":fw_dbg_test_component", |
| ":iwl_phy_db_test_component", |
| ":mac80211_test_component", |
| ":mac_ctxt_test_component", |
| ":mvm_test_component", # Issue with memory allocation. |
| ":notif_wait_test_component", |
| ":nvm_test_component", |
| ":pcie_test_component", # commented out bti, fake-pci etc to compile, and tests fail but compiles. |
| ":phy_ctxt_test_component", |
| ":platform_test_component", |
| # ":rcu_manager_test_component", # Requires async-testing loop. |
| ":sta_test_component", |
| #":task_test_component", # Requires async-testing loop. |
| ":utils_test_component", |
| ":wlan_softmac_device_test_component", |
| ":wlanphy_impl_device_test_component", |
| ], |
| ) |