WLAN Hardware Simulator, or hw-sim
, is a framework used to simulate a Fuchsia compatible WLAN device, its corresponding vendor driver and the radio environment it is in. It is mostly used to perform integration tests that involve some interaction between the system and the components mentioned above.
The most convenient way to run this test locally is to run it in a QEMU instance.
Make sure src/connectivity/wlan:tests
is included in with-base
so that the driver for the fake wlantap device is loaded in QEMU. For example:
fx set core.x64 --with-base src/connectivity/wlan:tests,bundles:tools
Start the emulator instance with
fx qemu
Note: If QEMU is not working, troubleshooting steps can be found here
In the QEMU command prompt, run the tests individually in the test
directory. For example:
run-test-suite simulate_scan
Rust tests hides stdout
when tests pass. To force displaying stdout
, run the test with --nocapture
run-test-suite simulate_scan --nocapture
After the test finishes, exit QEMU by
dm shutdown
ffx emu
from host)Setup QEMU network by following these instructions
(Googlers: Search “QEMU network setup” for additional steps for your workstation)
Same fx set
as the previous option
Start the emulator with -net tap
to enable network support
ffx emu start --engine qemu --headless --net tap
Once the emulator is started, run on the host,
fx test //src/connectivity/wlan/testing/hw-sim/test
To force stdout
display, pass --nocapture
with additional --
so that it does not get parsed by run-test
fx test //src/connectivity/wlan/testing/hw-sim/test -- --nocapture
Individual tests can be run with the name of their component as defined in BUILD.gn:
fx test configure-legacy-privacy-on
Run these commands to enable nested KVM for intel CPU to mimic the behavior of CQ bots. They to be run every time your workstation reboots.
sudo modprobe -r kvm_intel sudo modprobe kvm_intel nested=1
Verify the result by checking the content of the following file is Y
instead of N
.
$ cat /sys/module/kvm_intel/parameters/nested Y
Often when debugging flakiness, it is more helpful to run the tests repeatedly. Here is how:
Include bundles:tools
in your build, so that the seq
command is available. The previous example is now
fx set core.x64 --with-base bundles:tools,src/connectivity/wlan:tests,bundles:tools
Start an emulator instance
fx ffx emu start --engine qemu --headless --net tap --console
Run the test in the emulator command prompt:
for i in $(seq 1 1000); do run-test-suite simulate_scan || break; echo success: attempt $i; done;