class SimTest
Defined at line 231 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
WARNING: Don't use this test as a template for new tests as it uses the old driver testing
library.
A base class that can be used for creating simulation tests. It provides functionality that
should be common to most tests (like creating a new device instance and setting up and plugging
into the environment). It also provides a factory method for creating a new interface on the
simulated device.
Protected Members
unique_ptr env_
map ifaces_
WireSyncClient client_
WireSyncClient factory_client_
Arena test_arena_
Public Methods
void SimTest ()
Defined at line 519 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void ~SimTest ()
Defined at line 524 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t PreInit ()
In some cases (like error injection that affects the initialization) we want to work with
an uninitialized device. This method will allocate, but not initialize the device. To complete
initialization, the Init() function can be called after PreInit().
Defined at line 548 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t Init ()
Allocate device (if it hasn't already been allocated) and initialize it. This function doesn't
require PreInit() to be called first.
Defined at line 576 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
Protected Methods
async_dispatcher_t * df_env_dispatcher ()
Defined at line 283 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
async_dispatcher_t * driver_dispatcher ()
Defined at line 285 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
fdf_testing::DriverRuntime & runtime ()
Defined at line 286 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
zx_status_t StartInterface (wlan_common::WlanMacRole role, SimInterface * sim_ifc, std::optional<common::MacAddr> mac_addr)
Create a new interface on the simulated device, providing the specified role and function
callbacks
Defined at line 619 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t DeleteInterface (SimInterface * ifc)
Stop and delete a SimInterface
Defined at line 747 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t InterfaceDestroyed (SimInterface * sim_ifc)
To notify simulator that an interface was destroyed.
e.g. when going through crash recovery.
Defined at line 678 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
uint32_t DeviceCount ()
Defined at line 705 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
uint32_t DeviceCountWithProperty (const fuchsia_driver_framework::NodeProperty2 & property)
Defined at line 709 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void WaitForDeviceCount (uint32_t expected)
We don't have a good mechanism to synchronize the Remove call from
brcmfmac::Device with node_server_, so these functions repeatedly check the device count and
sleep until the device count matches the expected value.
The result is a timeout if it doesn't work instead of immediately failing, but the upside is
that we're no longer relying on the timing of the Remove call.
Defined at line 725 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void WaitForDeviceCountWithProperty (const fuchsia_driver_framework::NodeProperty2 & property, uint32_t expected)
Defined at line 731 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void WithSimDevice (fit::function<void (brcmfmac::SimDevice *)> )
Provides synchronous access to the brcmfmac::SimDevice instance via a callback. The callback
is posted to the SimDevice's dispatcher (i.e., driver_dispatcher_).
This can only be called after PreInit().
Note that there is a risk of deadlock here: if SimDevice makes a sync call to
WlanFullmacImplIfc (which blocks driver_dispatcher_ until the call is complete), and we try to
call WithSimDevice from the WlanFullmacImplIfc handler, it will deadlock because
driver_dispatcher_ is blocked from the original sync call from SimDevice.
Defined at line 738 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
fidl::ClientEnd<fuchsia_io::Directory> CreateDriverSvcClient ()
Defined at line 776 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t CreateFactoryClient ()
Defined at line 606 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc