{"slug": "show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware", "title": "Show HN: BSWorld – AI agents can now test Bluetooth code without hardware", "summary": "Xiaomi has released BSWorld, an open-source tool that tests Bluetooth Host stacks and applications on Linux through deterministic simulation, letting developers run BlueZ, Zephyr, NuttX, Apache NimBLE and TrouBLE suites without hardware or source-code changes. BSWorld connects Hosts to a BSController over H4 HCI and communicates over a shared BabbleSim radio, supporting path attenuation, injected interference and WLAN activity, and replay of recorded radio signals, with parallel scenarios via pytest-xdist. The Docker image ghcr.io/xiaomi/bsworld-linux:latest ships BabbleSim, a 32-bit UML kernel and a Guest root filesystem, and development requires Python 3.12 or newer on Ubuntu 24.04.", "body_md": "BSWorld tests Bluetooth Hosts and applications on Linux through deterministic simulation. Define the topology and expected behavior in pytest. Hosts connect to BSController over H4 HCI and communicate over a shared BabbleSim radio.\n\n- Test open-source Host stacks without hardware or changes to their source code.\n- Run multiple devices on one simulation clock. Run independent scenarios in parallel with pytest-xdist.\n- Set path attenuation, inject interference and WLAN activity, or replay recorded radio signals.\n- Inspect application logs, HCI BTSnoop captures, per-Controller radio captures, and shared Ellisys traces.\n\nBSWorld runs on Linux/x86_64.\n\nThe Docker image ships with BabbleSim, a 32-bit UML kernel, and a Guest root filesystem with the Host executables. Run the integration tests from the repository root on a host with [Docker Engine](https://docs.docker.com/engine/install/ubuntu/).\n\n```\nsudo docker pull ghcr.io/xiaomi/bsworld-linux:latest\nmkdir -p .cache/docker-results\n# The image runs as UID/GID 1000.\nsudo chown 1000:1000 .cache/docker-results\nsudo docker run --rm \\\n  --security-opt seccomp=docker/uml-seccomp.json \\\n  --mount \"type=bind,src=$PWD/.cache/docker-results,dst=/output\" \\\n  ghcr.io/xiaomi/bsworld-linux:latest\n```\n\nThe results in `.cache/docker-results` include `pytest.xml`, process logs, HCI captures, and RF traces. For suite selection, image versions, and local builds, see the [Docker guide](https://github.com/XiaoMi/bsworld/blob/main/docker/README.md).\n\nDevelopment and tests require Python 3.12 or newer. Install these tools on Ubuntu 24.04.\n\n```\nsudo apt-get update\nsudo apt-get install -y \\\n  bash ca-certificates curl git repo file make binutils build-essential \\\n  python3.12 python3.12-dev python3.12-venv python3-pip \\\n  gcc-multilib g++-multilib coreutils findutils grep sed\n```\n\nClone BSWorld and install it in a virtual environment.\n\n```\ngit clone https://github.com/XiaoMi/bsworld.git\ncd bsworld\nexport BSWORLD_ROOT=\"$PWD\"\npython3.12 -m venv .venv\nsource .venv/bin/activate\npython -m pip install -e components/bscontroller -e '.[test]'\n```\n\nRun the development checks.\n\n```\nruff check .\nruff format --check .\npytest tests/unit -q\n```\n\nFetch the BabbleSim revisions pinned in `components/babblesim.xml`.\n\n```\nmkdir -p \"$BSWORLD_ROOT/.cache/babblesim\"\ncd \"$BSWORLD_ROOT/.cache/babblesim\"\nrepo init --standalone-manifest --depth=1 -u \"file://$BSWORLD_ROOT/components/babblesim.xml\"\nrepo sync -c --no-tags\n```\n\nSet the build paths and compile BabbleSim.\n\n```\nexport BSIM_OUT_PATH=\"$PWD/build\"\nexport BSIM_COMPONENTS_PATH=\"$PWD/components\"\nexport BSIM_BUILD_FAIL_ASAP=1\nmake -j\"$(nproc)\" everything\n```\n\nRun the BabbleSim integration tests from the repository root. In a new shell, activate `.venv` and restore `BSWORLD_ROOT` and `BSIM_OUT_PATH` before running the tests.\n\n```\ncd \"$BSWORLD_ROOT\"\npytest tests/integration/babblesim -n auto\n```\n\nTo run the Host integration suites locally, prepare a 32-bit Guest as described in the [UML test environment guide](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/README.md).\n\nEach suite runs its Host in a UML Guest and tests it against Bumble on the same simulated radio.\n\n| Guest Host | Coverage | \n|---|---|\n| [BlueZ](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/bluez/README.md) | Multi-Guest advertising, scanning, connection and disconnection | \n| [Zephyr Bluetooth shell](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/zephyr/README.md) | Advertising, scanning, GATT, pairing, privacy, link updates, periodic advertising and sync transfer | \n| [NuttX BTSak and NimBLE](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/nuttx/README.md) | Advertising, multi-device scanning, interference recovery, GATT reads, writes and notifications | \n| [Apache NimBLE Linux](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/nimble/README.md) | Discovery and connection | \n| [TrouBLE](https://github.com/XiaoMi/bsworld/blob/main/tests/integration/uml/trouble/README.md) | Battery Service discovery, reads, and notifications in both roles | \n\nEach Host connects to its own BSController over H4 HCI. The Controllers, the pytest clock, and any configured interference sources share a BabbleSim PHY.\n\nBumble runs in the pytest event loop. Each UML Guest runs in a separate process and receives simulation time from that loop through its own time-travel socket. A topology can run several Guests together.\n\nTo set per-Controller options such as device address, buffer sizes, and Bluetooth version, see [BSController configuration](https://github.com/XiaoMi/bsworld/blob/main/docs/controllers.md).\n\nOpen `hciN.snoop` and `radioN.pcapng` in Wireshark to inspect a Controller's HCI traffic and radio activity. The shared `babblesim/ellisys.bttrp` collects BSController transmissions for Ellisys. For capture scope and file locations, see [Logs, traces, and captures](https://github.com/XiaoMi/bsworld/blob/main/docs/artifacts.md).\n\n| Time base | Meaning | \n|---|---|\n| **Simulation time** | Advances when all PHY participants synchronize. It governs protocol timers, packet timing, RF events, asyncio waits, and test timeouts. | \n| **Wall-clock time** | Measures test duration on the host and varies with CPU load and Linux scheduling. | \n\nAfter startup, standard `asyncio` waits and timeouts use simulation time. See [Async waiting and simulation time](https://github.com/XiaoMi/bsworld/blob/main/docs/writing-tests.md#async-waiting-and-simulation-time) for examples.\n\nRepeatability assumes identical binaries and inputs and controlled random sources. External networks, wall-clock-driven services, and other unadapted Host I/O can still introduce nondeterminism.\n\nBSWorld is licensed under the [Apache License 2.0](https://github.com/XiaoMi/bsworld/blob/main/LICENSE). For third-party licenses, see [Third-Party Notices](https://github.com/XiaoMi/bsworld/blob/main/THIRD_PARTY_NOTICES.md).", "url": "https://wpnews.pro/news/show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware", "canonical_source": "https://github.com/XiaoMi/bsworld", "published_at": "2026-11-20 06:06:42+00:00", "updated_at": "2026-11-20 06:14:34.521539+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents"], "entities": ["Xiaomi", "BSWorld", "BabbleSim", "BlueZ", "Zephyr", "NuttX", "Apache NimBLE", "TrouBLE"], "also_reported_by": [], "takeaway": "BSWorld runs Bluetooth Host stacks such as BlueZ, Zephyr and NimBLE against Bumble on a shared BabbleSim radio inside a 32-bit UML Guest, so integration tests need no physical hardware and no source changes.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware", "markdown": "https://wpnews.pro/news/show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware.md", "text": "https://wpnews.pro/news/show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware.txt", "jsonld": "https://wpnews.pro/news/show-hn-bsworld-ai-agents-can-now-test-bluetooth-code-without-hardware.jsonld"}}