BSWorld tests Bluetooth LE Hosts on Linux without radio hardware. A pytest test defines the devices and the radio conditions. Each Host connects over H4 HCI to its own BSController, and all Controllers share one simulated radio and one simulation clock.
- Test open-source Host stacks without hardware or changes to their source code.
- Repeat runs exactly. Protocol timers, radio events and test timeouts follow simulation time, not host speed.
- Set path attenuation, inject interference or WLAN traffic, or replay recorded radio activity.
- Debug with per-test console logs, HCI captures, radio captures and a shared Ellisys trace.
BSWorld needs Linux on x86_64 and Python 3.12 or newer. Build BabbleSim with every target in the BS2G4PHY build guide, and keep BSIM_OUT_PATH set in the shell.
Install the Python 3.12 development packages.
sudo apt-get install -y python3.12-dev python3.12-venvClone BSWorld. The guides use BSWORLD_ROOT for the checkout path.
git clone https://github.com/XiaoMi/bsworld.git
cd bsworld
export BSWORLD_ROOT="$PWD"Install BSWorld and its components into a virtual environment.
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-dev.txtCheck the setup. The suite starts a BabbleSim PHY with BSControllers and checks their captures.
pytest tests/integration/babblesim -qIn a new shell, run source .venv/bin/activate and set BSWORLD_ROOT and BSIM_OUT_PATH again.
Each suite runs the Host in a UML Guest against a Bumble peer.
| Host | Coverage |
|---|---|
| BlueZ | Advertising from two Guests, scanning, connection and disconnection |
| Zephyr Bluetooth shell | Scanning, advertising, GATT, pairing, privacy, link updates, periodic advertising and sync transfer |
| NuttX BTSak and NimBLE | Advertising, scanning, recovery after interference, GATT reads, writes and notifications |
| Apache NimBLE Linux | Advertising and connection |
| TrouBLE | Battery Service discovery, reads and notifications in both roles |
Each Host has its own BSController. Bumble runs in the pytest event loop and connects to the Controller's H4 socket. A UML Guest runs as a separate process. BSWorld bridges its Virtio Bluetooth device to the Controller and advances the Guest's clock through UML time-travel.
The Controllers, the pytest event loop and any interference sources are participants of one BabbleSim PHY, which grants simulation time to one participant at a time. After topo.start(), asyncio.sleep() and timeouts in the test count simulation time.
BSWorld is built from four components, each published on PyPI:
| Component | Role |
|---|---|
| BS2G4PHY | Python participants on a BabbleSim 2.4 GHz PHY: process startup, device IDs, frames, attenuation and interference |
| BSClock | An asyncio event loop that runs on simulation time |
| BSController | A software Bluetooth LE Controller with an H4 HCI interface |
| BSUML | User Mode Linux guests on simulation time: the time-travel calendar and a vhost-user backend for Virtio devices |
- Writing tests: topology, simulation time, UML Guests and radio conditions
- Logs and captures: where each test writes its artifacts and how to read them
- UML Host tests: building the Guest kernel, root filesystem and Host programs
- Docker image: running the integration suites in a container
- Development: test suites, code style, CI and releases
- Contributing, Code of Conduct, Security Policy
BSWorld is licensed under the Apache License 2.0. See Third-Party Notices for the software it builds on.