class SimTest
Defined at line 259 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
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_
SyncClient client_
WireSyncClient factory_client_
Arena test_arena_
Public Methods
void SimTest ()
Defined at line 578 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void ~SimTest ()
Defined at line 583 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 599 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 629 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 315 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
fdf_testing::DriverRuntime & runtime ()
Defined at line 322 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
fdf_testing::BackgroundDriverTest<TestConfig> & driver_test ()
Defined at line 323 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.h
zx_status_t StartInterface (wlan_common::WlanMacRolerole,SimInterface *sim_ifc,std::optional<wlan::common::MacAddr>mac_addr)
Create a new interface on the simulated device, providing the specified role and function
callbacks
Defined at line 665 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 793 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 725 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
uint32_t DeviceCount ()
Defined at line 745 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 750 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 766 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 772 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
void WaitForRecoveryComplete ()
Wait for recovery to complete on the calling thread. Recovery happens on the driver dispatcher,
so this should never be called on the driver dispatcher. Doing so will deadlock the test.
Defined at line 779 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 788 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
fidl::ClientEnd<fuchsia_io::Directory> CreateDriverSvcClient ()
Defined at line 821 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc
zx_status_t CreateFactoryClient ()
Defined at line 656 of file ../../src/connectivity/wlan/drivers/third_party/broadcom/brcmfmac/sim/test/sim_test.cc