bsworld 1.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. bsworld-1.1.3/.gitignore +22 -0
  2. bsworld-1.1.3/.python-version +1 -0
  3. bsworld-1.1.3/CODE_OF_CONDUCT.md +44 -0
  4. bsworld-1.1.3/CONTRIBUTING.md +132 -0
  5. bsworld-1.1.3/LICENSE +201 -0
  6. bsworld-1.1.3/MANIFEST.in +6 -0
  7. bsworld-1.1.3/PKG-INFO +183 -0
  8. bsworld-1.1.3/README.md +160 -0
  9. bsworld-1.1.3/SECURITY.md +39 -0
  10. bsworld-1.1.3/THIRD_PARTY_NOTICES.md +78 -0
  11. bsworld-1.1.3/conftest.py +30 -0
  12. bsworld-1.1.3/docs/artifacts.md +163 -0
  13. bsworld-1.1.3/docs/controllers.md +129 -0
  14. bsworld-1.1.3/docs/development.md +72 -0
  15. bsworld-1.1.3/docs/images/babblesim_arch.svg +128 -0
  16. bsworld-1.1.3/docs/images/bluetooth-diagram.mmd +41 -0
  17. bsworld-1.1.3/docs/images/bluetooth-diagram.svg +1 -0
  18. bsworld-1.1.3/docs/images/ellisys-trace-import.gif +0 -0
  19. bsworld-1.1.3/docs/images/pytest-topology-execution.svg +1 -0
  20. bsworld-1.1.3/docs/images/virtual-ble-topology.mmd +101 -0
  21. bsworld-1.1.3/docs/writing-tests.md +256 -0
  22. bsworld-1.1.3/docs/zh-CH/CODE_OF_CONDUCT.md +44 -0
  23. bsworld-1.1.3/docs/zh-CH/CONTRIBUTING.md +132 -0
  24. bsworld-1.1.3/docs/zh-CH/README.md +160 -0
  25. bsworld-1.1.3/docs/zh-CH/SECURITY.md +39 -0
  26. bsworld-1.1.3/docs/zh-CH/THIRD_PARTY_NOTICES.md +78 -0
  27. bsworld-1.1.3/docs/zh-CH/artifacts.md +163 -0
  28. bsworld-1.1.3/docs/zh-CH/controllers.md +129 -0
  29. bsworld-1.1.3/docs/zh-CH/development.md +72 -0
  30. bsworld-1.1.3/docs/zh-CH/writing-tests.md +255 -0
  31. bsworld-1.1.3/pyproject.toml +94 -0
  32. bsworld-1.1.3/setup.cfg +4 -0
  33. bsworld-1.1.3/src/bsworld/__init__.py +31 -0
  34. bsworld-1.1.3/src/bsworld/backends/__init__.py +14 -0
  35. bsworld-1.1.3/src/bsworld/backends/babblesim.py +461 -0
  36. bsworld-1.1.3/src/bsworld/backends/ellisys.py +66 -0
  37. bsworld-1.1.3/src/bsworld/deps.py +100 -0
  38. bsworld-1.1.3/src/bsworld/devices/__init__.py +32 -0
  39. bsworld-1.1.3/src/bsworld/devices/bscontroller.py +92 -0
  40. bsworld-1.1.3/src/bsworld/devices/controller.py +81 -0
  41. bsworld-1.1.3/src/bsworld/devices/instance.py +152 -0
  42. bsworld-1.1.3/src/bsworld/devices/layout.py +208 -0
  43. bsworld-1.1.3/src/bsworld/devices/zephyr.py +71 -0
  44. bsworld-1.1.3/src/bsworld/env.py +120 -0
  45. bsworld-1.1.3/src/bsworld/interference.py +390 -0
  46. bsworld-1.1.3/src/bsworld/log.py +73 -0
  47. bsworld-1.1.3/src/bsworld/plugin.py +155 -0
  48. bsworld-1.1.3/src/bsworld/runtime/__init__.py +14 -0
  49. bsworld-1.1.3/src/bsworld/runtime/pipe.py +185 -0
  50. bsworld-1.1.3/src/bsworld/runtime/proc.py +227 -0
  51. bsworld-1.1.3/src/bsworld/runtime/scheduler/__init__.py +34 -0
  52. bsworld-1.1.3/src/bsworld/runtime/scheduler/babblesim.py +186 -0
  53. bsworld-1.1.3/src/bsworld/runtime/shell.py +83 -0
  54. bsworld-1.1.3/src/bsworld/runtime/wait.py +85 -0
  55. bsworld-1.1.3/src/bsworld/topology.py +308 -0
  56. bsworld-1.1.3/src/bsworld.egg-info/PKG-INFO +183 -0
  57. bsworld-1.1.3/src/bsworld.egg-info/SOURCES.txt +176 -0
  58. bsworld-1.1.3/src/bsworld.egg-info/dependency_links.txt +1 -0
  59. bsworld-1.1.3/src/bsworld.egg-info/entry_points.txt +2 -0
  60. bsworld-1.1.3/src/bsworld.egg-info/requires.txt +13 -0
  61. bsworld-1.1.3/src/bsworld.egg-info/scm_file_list.json +354 -0
  62. bsworld-1.1.3/src/bsworld.egg-info/scm_version.json +8 -0
  63. bsworld-1.1.3/src/bsworld.egg-info/top_level.txt +1 -0
  64. bsworld-1.1.3/tests/__init__.py +15 -0
  65. bsworld-1.1.3/tests/integration/applications.py +81 -0
  66. bsworld-1.1.3/tests/integration/babblesim/test_babblesim_clock.py +123 -0
  67. bsworld-1.1.3/tests/integration/babblesim/test_hci_snoop.py +71 -0
  68. bsworld-1.1.3/tests/integration/bumble/README.md +58 -0
  69. bsworld-1.1.3/tests/integration/bumble/README.zh-CN.md +58 -0
  70. bsworld-1.1.3/tests/integration/bumble/broadcast_observe/test_bumble_broadcast_observe.py +170 -0
  71. bsworld-1.1.3/tests/integration/bumble/common/__init__.py +134 -0
  72. bsworld-1.1.3/tests/integration/bumble/conftest.py +35 -0
  73. bsworld-1.1.3/tests/integration/bumble/connection/test_bumble_connection.py +51 -0
  74. bsworld-1.1.3/tests/integration/bumble/periodic_advertising/test_bumble_periodic_advertising.py +126 -0
  75. bsworld-1.1.3/tests/integration/controllers.py +32 -0
  76. bsworld-1.1.3/tests/integration/nuttx/README.md +66 -0
  77. bsworld-1.1.3/tests/integration/nuttx/README.zh-CN.md +66 -0
  78. bsworld-1.1.3/tests/integration/nuttx/btsak/README.md +74 -0
  79. bsworld-1.1.3/tests/integration/nuttx/btsak/README.zh-CN.md +74 -0
  80. bsworld-1.1.3/tests/integration/nuttx/btsak/devices.py +51 -0
  81. bsworld-1.1.3/tests/integration/nuttx/btsak/test_btsak_scan_advertise.py +209 -0
  82. bsworld-1.1.3/tests/integration/nuttx/common/__init__.py +81 -0
  83. bsworld-1.1.3/tests/integration/nuttx/conftest.py +9 -0
  84. bsworld-1.1.3/tests/integration/nuttx/nimble/README.md +78 -0
  85. bsworld-1.1.3/tests/integration/nuttx/nimble/README.zh-CN.md +78 -0
  86. bsworld-1.1.3/tests/integration/nuttx/nimble/devices.py +39 -0
  87. bsworld-1.1.3/tests/integration/nuttx/nimble/test_central_peripheral.py +86 -0
  88. bsworld-1.1.3/tests/integration/qemu/README.md +132 -0
  89. bsworld-1.1.3/tests/integration/qemu/README.zh-CN.md +132 -0
  90. bsworld-1.1.3/tests/integration/qemu/bluez/README.md +27 -0
  91. bsworld-1.1.3/tests/integration/qemu/bluez/README.zh-CN.md +27 -0
  92. bsworld-1.1.3/tests/integration/qemu/bluez/test_qemu_bluez.py +187 -0
  93. bsworld-1.1.3/tests/integration/qemu/common.py +108 -0
  94. bsworld-1.1.3/tests/integration/qemu/conftest.py +9 -0
  95. bsworld-1.1.3/tests/integration/qemu/nimble/README.md +23 -0
  96. bsworld-1.1.3/tests/integration/qemu/nimble/README.zh-CN.md +23 -0
  97. bsworld-1.1.3/tests/integration/qemu/nimble/test_qemu_nimble_linux.py +91 -0
  98. bsworld-1.1.3/tests/integration/qemu/source/Config.in +9 -0
  99. bsworld-1.1.3/tests/integration/qemu/source/README.md +21 -0
  100. bsworld-1.1.3/tests/integration/qemu/source/README.zh-CN.md +21 -0
  101. bsworld-1.1.3/tests/integration/qemu/source/board/linux/linux.fragment +9 -0
  102. bsworld-1.1.3/tests/integration/qemu/source/configs/bsworld_qemu_linux_defconfig +28 -0
  103. bsworld-1.1.3/tests/integration/qemu/source/external.desc +6 -0
  104. bsworld-1.1.3/tests/integration/qemu/source/external.mk +5 -0
  105. bsworld-1.1.3/tests/integration/qemu/source/package/bsworld-nimble-linux/Config.in +15 -0
  106. bsworld-1.1.3/tests/integration/qemu/source/package/bsworld-nimble-linux/bsworld-nimble-linux.hash +4 -0
  107. bsworld-1.1.3/tests/integration/qemu/source/package/bsworld-nimble-linux/bsworld-nimble-linux.mk +30 -0
  108. bsworld-1.1.3/tests/integration/support/test_applications.py +163 -0
  109. bsworld-1.1.3/tests/integration/support/test_artifact_paths.py +148 -0
  110. bsworld-1.1.3/tests/integration/trouble/README.md +67 -0
  111. bsworld-1.1.3/tests/integration/trouble/README.zh-CN.md +69 -0
  112. bsworld-1.1.3/tests/integration/trouble/conftest.py +9 -0
  113. bsworld-1.1.3/tests/integration/trouble/source/Cargo.lock +1038 -0
  114. bsworld-1.1.3/tests/integration/trouble/source/Cargo.toml +47 -0
  115. bsworld-1.1.3/tests/integration/trouble/source/rust-toolchain.toml +4 -0
  116. bsworld-1.1.3/tests/integration/trouble/source/rustfmt.toml +4 -0
  117. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/babblesim.rs +158 -0
  118. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/executor.rs +115 -0
  119. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/mod.rs +16 -0
  120. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/tests.rs +241 -0
  121. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/time.rs +68 -0
  122. bsworld-1.1.3/tests/integration/trouble/source/src/bsim/unix.rs +130 -0
  123. bsworld-1.1.3/tests/integration/trouble/source/src/main.rs +50 -0
  124. bsworld-1.1.3/tests/integration/trouble/test_trouble_native.py +107 -0
  125. bsworld-1.1.3/tests/integration/zephyr/README.md +60 -0
  126. bsworld-1.1.3/tests/integration/zephyr/README.zh-CN.md +60 -0
  127. bsworld-1.1.3/tests/integration/zephyr/devices.py +46 -0
  128. bsworld-1.1.3/tests/integration/zephyr/shell/README.md +86 -0
  129. bsworld-1.1.3/tests/integration/zephyr/shell/README.zh-CN.md +86 -0
  130. bsworld-1.1.3/tests/integration/zephyr/shell/__init__.py +3 -0
  131. bsworld-1.1.3/tests/integration/zephyr/shell/bumble_peer/README.md +38 -0
  132. bsworld-1.1.3/tests/integration/zephyr/shell/bumble_peer/README.zh-CN.md +38 -0
  133. bsworld-1.1.3/tests/integration/zephyr/shell/bumble_peer/__init__.py +0 -0
  134. bsworld-1.1.3/tests/integration/zephyr/shell/bumble_peer/conftest.py +46 -0
  135. bsworld-1.1.3/tests/integration/zephyr/shell/bumble_peer/test_bumble.py +289 -0
  136. bsworld-1.1.3/tests/integration/zephyr/shell/conftest.py +8 -0
  137. bsworld-1.1.3/tests/integration/zephyr/shell/devices.py +47 -0
  138. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/README.md +63 -0
  139. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/README.zh-CN.md +63 -0
  140. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/__init__.py +0 -0
  141. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/common.py +82 -0
  142. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/conftest.py +48 -0
  143. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_coded.py +29 -0
  144. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_gatt.py +20 -0
  145. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_link_updates.py +63 -0
  146. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_privacy.py +66 -0
  147. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_radio.py +52 -0
  148. bsworld-1.1.3/tests/integration/zephyr/shell/shell_peer/test_scan.py +33 -0
  149. bsworld-1.1.3/tests/integration/zephyr/shell/source/bsim_host_only.overlay +19 -0
  150. bsworld-1.1.3/tests/integration/zephyr/shell/source/full.conf +7 -0
  151. bsworld-1.1.3/tests/integration/zephyr/shell/source/le.conf +23 -0
  152. bsworld-1.1.3/tests/integration/zephyr/shell/source/prj.conf +49 -0
  153. bsworld-1.1.3/tests/integration/zephyr/shell_common.py +21 -0
  154. bsworld-1.1.3/tests/unit/README.md +37 -0
  155. bsworld-1.1.3/tests/unit/backends/test_babblesim.py +496 -0
  156. bsworld-1.1.3/tests/unit/backends/test_ellisys.py +98 -0
  157. bsworld-1.1.3/tests/unit/conftest.py +31 -0
  158. bsworld-1.1.3/tests/unit/devices/test_bscontroller.py +220 -0
  159. bsworld-1.1.3/tests/unit/devices/test_controller.py +46 -0
  160. bsworld-1.1.3/tests/unit/devices/test_instance.py +142 -0
  161. bsworld-1.1.3/tests/unit/devices/test_layout.py +145 -0
  162. bsworld-1.1.3/tests/unit/helpers.py +81 -0
  163. bsworld-1.1.3/tests/unit/runtime/scheduler/support.py +68 -0
  164. bsworld-1.1.3/tests/unit/runtime/scheduler/test_bsim_clock.py +292 -0
  165. bsworld-1.1.3/tests/unit/runtime/scheduler/test_event_loop.py +218 -0
  166. bsworld-1.1.3/tests/unit/runtime/test_pipe.py +140 -0
  167. bsworld-1.1.3/tests/unit/runtime/test_proc.py +241 -0
  168. bsworld-1.1.3/tests/unit/runtime/test_shell.py +85 -0
  169. bsworld-1.1.3/tests/unit/runtime/test_wait.py +120 -0
  170. bsworld-1.1.3/tests/unit/test_attachment.py +186 -0
  171. bsworld-1.1.3/tests/unit/test_deps.py +123 -0
  172. bsworld-1.1.3/tests/unit/test_env.py +81 -0
  173. bsworld-1.1.3/tests/unit/test_firmware.py +84 -0
  174. bsworld-1.1.3/tests/unit/test_interference.py +213 -0
  175. bsworld-1.1.3/tests/unit/test_log.py +93 -0
  176. bsworld-1.1.3/tests/unit/test_plugin.py +223 -0
  177. bsworld-1.1.3/tests/unit/test_topology.py +339 -0
  178. bsworld-1.1.3/tests/unit/test_version.py +45 -0
@@ -0,0 +1,22 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.egg-info/
5
+ .venv/
6
+
7
+ # Build and test artifacts
8
+ build/
9
+ dist/
10
+ prebuilt/
11
+ target/
12
+ .cache/
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+ .coverage
16
+ .coverage.*
17
+
18
+ # Local configuration
19
+ .vscode/
20
+ *.local
21
+ .env
22
+ .env.*
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,44 @@
1
+ # Code of Conduct
2
+
3
+ [English](CODE_OF_CONDUCT.md) | [简体中文](docs/zh-CH/CODE_OF_CONDUCT.md)
4
+
5
+ ## Our Pledge
6
+
7
+ We pledge to make participation in the BSWorld community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
8
+
9
+ We will act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
10
+
11
+ ## Expected Behavior
12
+
13
+ Examples of behavior that contributes to a positive community include:
14
+
15
+ - showing empathy, patience, and respect toward other people;
16
+ - respecting differing opinions, experiences, and technical approaches;
17
+ - giving and accepting constructive technical feedback;
18
+ - taking responsibility for mistakes, correcting them, and learning from them;
19
+ - focusing discussion on the project and the needs of the wider community.
20
+
21
+ Unacceptable behavior includes:
22
+
23
+ - sexualized language or imagery, or unwelcome sexual attention or advances;
24
+ - trolling, insults, derogatory comments, or personal and political attacks;
25
+ - public or private harassment;
26
+ - publishing another person's private information without explicit permission;
27
+ - threats, intimidation, deliberate disruption, or sustained bad-faith participation;
28
+ - other conduct that would reasonably be considered inappropriate in a professional setting.
29
+
30
+ ## Scope
31
+
32
+ This Code of Conduct applies to project repositories, issues, pull requests, reviews, discussions, chat channels, events, and other spaces managed by the project. It also applies when someone officially represents BSWorld in a public space.
33
+
34
+ ## Reporting and Enforcement
35
+
36
+ Report abusive, harassing, or otherwise unacceptable behavior privately by emailing [menglingao@xiaomi.com](mailto:menglingao@xiaomi.com). Do not open a public issue containing personal or sensitive details.
37
+
38
+ Project maintainers will review reports fairly, protect the privacy and safety of reporters, and take action appropriate to the circumstances. Maintainers may edit or remove comments, commits, code, issues, and other contributions that violate this policy. Depending on the severity and history of the behavior, consequences may include a private correction, formal warning, temporary restriction, or permanent removal from project spaces.
39
+
40
+ Anyone responsible for handling a report must disclose a conflict of interest and withdraw from that case. Retaliation against a person who reports an incident or participates in an investigation is itself a violation of this Code of Conduct.
41
+
42
+ ## Attribution
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Its Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
@@ -0,0 +1,132 @@
1
+ # Contributing to BSWorld
2
+
3
+ [English](CONTRIBUTING.md) | [简体中文](docs/zh-CH/CONTRIBUTING.md)
4
+
5
+ Thank you for contributing to BSWorld. Contributions may include bug fixes, tests, documentation, new Bluetooth LE Application environments, platform integrations, and improvements to the deterministic runtime or RF orchestration.
6
+
7
+ BSWorld's first-party code is licensed under Apache License 2.0. Imported or reused components retain their original licenses and are identified in their source files and [Third-Party Notices](THIRD_PARTY_NOTICES.md). All commits use the [Developer Certificate of Origin](https://developercertificate.org/) process and record the contributor's certification with a `Signed-off-by` line.
8
+
9
+ ## Before You Start
10
+
11
+ - Search existing issues before opening a new one.
12
+ - Use [SECURITY.md](SECURITY.md) for vulnerabilities. Do not disclose security-sensitive details in a public issue.
13
+ - Open an issue before starting a substantial architectural change, new backend, or broad API change so the design and scope can be discussed first.
14
+ - Small fixes, focused tests, and documentation corrections may be submitted directly as a pull request.
15
+ - Follow the [Code of Conduct](CODE_OF_CONDUCT.md) in all project spaces.
16
+
17
+ ## Development Setup
18
+
19
+ We recommend the [Docker test image](docker/README.md#run-tests) with your checkout mounted at `/workspace` for lint, unit tests, and integration tests. To change firmware or build configuration, [build your own image](docker/README.md#build).
20
+
21
+ ## Making Changes
22
+
23
+ - Keep each change focused on one behavior or problem. Avoid unrelated refactoring and generated-file churn.
24
+ - Follow the existing separation between reusable framework code in `src/bsworld/` and Application-specific profiles, build files, and scenarios under `tests/`.
25
+ - Use standard asyncio APIs for asynchronous test work. Do not use blocking waits such as `time.sleep()` in an async test.
26
+ - Add or update tests for externally visible behavior. Prefer assertions on public outcomes over private implementation details.
27
+ - Update English and Chinese documentation together when behavior, commands, or public interfaces change.
28
+ - Do not commit locally compiled binaries, caches, or test logs.
29
+ - Add the Apache-2.0 copyright header used by neighboring files to new first-party source, configuration, and script files. Preserve upstream license headers in third-party code and update `THIRD_PARTY_NOTICES*` when introducing a new external component.
30
+
31
+ ## Validation
32
+
33
+ Run the checks relevant to the change in the [Docker environment](docker/README.md#run-tests) with your checkout mounted, or in the local Python environment. At minimum, framework changes should pass:
34
+
35
+ ```sh
36
+ ruff check --no-cache .
37
+ ruff format --check --no-cache .
38
+ pytest tests/unit/
39
+ ```
40
+
41
+ Follow the repository's Python [code style](docs/development.md#code-style). The `Code style` workflow checks all maintained Python code on every push and pull request.
42
+
43
+ Run the affected virtual-system suite when changing process startup, scheduling, HCI, RF behavior, platform configuration, or test Applications. For example:
44
+
45
+ ```sh
46
+ pytest tests/integration/nuttx/btsak -n auto
47
+ pytest tests/integration/nuttx/nimble -n auto
48
+ pytest tests/integration/zephyr/shell -n auto
49
+ pytest tests/integration/bumble -n auto
50
+ ```
51
+
52
+ Use the full suite when the change crosses subsystem boundaries:
53
+
54
+ ```sh
55
+ pytest tests/ -n auto
56
+ ```
57
+
58
+ If a required suite cannot be run locally, state that explicitly in the pull request and explain why.
59
+
60
+ ## Pull Requests
61
+
62
+ A pull request should:
63
+
64
+ - explain the problem and why the change is needed;
65
+ - describe the resulting behavior, including compatibility implications;
66
+ - list the exact validation commands and results;
67
+ - include matching tests and documentation where applicable;
68
+ - identify new dependencies, copied code, generated assets, or license implications;
69
+ - avoid credentials, private logs, machine-specific paths, and unrelated binary files.
70
+
71
+ Review may request that a large change be split into smaller commits. Commit messages should be concise, use the imperative mood, and describe the externally meaningful change rather than the editing process.
72
+
73
+ ## Developer Certificate of Origin
74
+
75
+ BSWorld uses the Developer Certificate of Origin 1.1 instead of a separate contributor license agreement. Every commit in a pull request must contain a sign-off line with the contributor's real name and email address:
76
+
77
+ ```text
78
+ Signed-off-by: Jane Doe <jane@example.com>
79
+ ```
80
+
81
+ Add it automatically when creating a commit:
82
+
83
+ ```sh
84
+ git commit --signoff
85
+ ```
86
+
87
+ To sign an existing local commit, amend it before publishing the pull request:
88
+
89
+ ```sh
90
+ git commit --amend --signoff --no-edit
91
+ ```
92
+
93
+ The sign-off certifies your agreement to the following declaration:
94
+
95
+ ```text
96
+ Developer Certificate of Origin
97
+ Version 1.1
98
+
99
+ Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
100
+ 1 Letterman Drive
101
+ Suite D4700
102
+ San Francisco, CA, 94129
103
+
104
+ Everyone is permitted to copy and distribute verbatim copies of this
105
+ license document, but changing it is not allowed.
106
+
107
+ Developer's Certificate of Origin 1.1
108
+
109
+ By making a contribution to this project, I certify that:
110
+
111
+ (a) The contribution was created in whole or in part by me and I
112
+ have the right to submit it under the open source license
113
+ indicated in the file; or
114
+
115
+ (b) The contribution is based upon previous work that, to the best
116
+ of my knowledge, is covered under an appropriate open source
117
+ license and I have the right under that license to submit that
118
+ work with modifications, whether created in whole or in part
119
+ by me, under the same open source license (unless I am
120
+ permitted to submit under a different license), as indicated
121
+ in the file; or
122
+
123
+ (c) The contribution was provided directly to me by some other
124
+ person who certified (a), (b) or (c) and I have not modified
125
+ it.
126
+
127
+ (d) I understand and agree that this project and the contribution
128
+ are public and that a record of the contribution (including all
129
+ personal information I submit with it, including my sign-off) is
130
+ maintained indefinitely and may be redistributed consistent with
131
+ this project or the open source license(s) involved.
132
+ ```
bsworld-1.1.3/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ # bscontroller is released as its own package; CI and image files are not
2
+ # part of the bsworld source distribution.
3
+ prune components
4
+ prune docker
5
+ prune .github
6
+ exclude .dockerignore
bsworld-1.1.3/PKG-INFO ADDED
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: bsworld
3
+ Version: 1.1.3
4
+ Summary: Deterministic simulation test framework for Bluetooth LE Applications
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/XiaoMi/bsworld
7
+ Project-URL: Issues, https://github.com/XiaoMi/bsworld/issues
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: pytest>=8.4
12
+ Requires-Dist: pytest-asyncio>=1.4
13
+ Requires-Dist: bscontroller<0.2,>=0.1
14
+ Provides-Extra: bumble
15
+ Requires-Dist: bumble==0.0.235; extra == "bumble"
16
+ Provides-Extra: test
17
+ Requires-Dist: bumble==0.0.235; extra == "test"
18
+ Requires-Dist: packaging>=24; extra == "test"
19
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
20
+ Requires-Dist: pytest-xdist>=3.0; extra == "test"
21
+ Requires-Dist: ruff==0.14.10; extra == "test"
22
+ Dynamic: license-file
23
+
24
+ # BSWorld
25
+
26
+ [English](README.md) | [简体中文](docs/zh-CH/README.md)
27
+
28
+ BSWorld is a deterministic simulation framework for testing Bluetooth Hosts and Applications on Linux. A pytest scenario defines the device topology and expected behavior; BSWorld runs the participants on a shared BabbleSim radio and simulation clock, then archives logs and protocol traces.
29
+
30
+ Use BSWorld to:
31
+
32
+ - Test open-source Host stacks such as Zephyr, NuttX, BlueZ, NimBLE, Bumble, and TrouBLE without modifying their source code.
33
+ - Run without hardware: Hosts connect over standard H4 HCI to virtual Controllers, or complete firmware joins the PHY with its own Controller and radio.
34
+ - Keep Application logs, HCI BTSnoop captures, PHY logs, and Ellisys traces for debugging failures.
35
+ - Simulate many devices in one scenario. Repeated runs of the same scenario produce consistent logs and timing, regardless of host load or scheduling.
36
+ - Share one discrete simulation clock across all devices. Scenarios are isolated and run in parallel with pytest-xdist, up to 100 times faster than real time.
37
+ - Inject attenuation, interference, WLAN activity, and recorded radio signals.
38
+
39
+ ## Quick Start
40
+
41
+ BSWorld runs on Linux/x86_64. The published Docker image includes Python, BSWorld, and the firmware required by the integration tests.
42
+
43
+ ### Docker (Recommended)
44
+
45
+ Install [Docker Engine](https://docs.docker.com/engine/install/ubuntu/), then run the packaged integration tests:
46
+
47
+ ```sh
48
+ sudo docker pull ghcr.io/xiaomi/bsworld:latest
49
+ mkdir -p .cache/docker-results
50
+ # The published image runs as UID/GID 1000.
51
+ sudo chown 1000:1000 .cache/docker-results
52
+ sudo docker run --rm \
53
+ -e PYTHONPATH=/workspace \
54
+ --mount "type=bind,src=$PWD/.cache/docker-results,dst=/output" \
55
+ ghcr.io/xiaomi/bsworld:latest
56
+ ```
57
+
58
+ Results are written to `.cache/docker-results`, including `pytest.xml`, process logs, HCI captures, and RF traces. See the [Docker guide](docker/README.md) to run a selected suite, test the current checkout, choose an image version, or build an image.
59
+
60
+ ### Local Linux
61
+
62
+ Development and test commands require Python 3.12 or newer. On Ubuntu 24.04, install the required tools:
63
+
64
+ ```sh
65
+ sudo apt-get update
66
+ sudo apt-get install -y \
67
+ bash ca-certificates curl git repo file make binutils build-essential \
68
+ python3.12 python3.12-dev python3.12-venv python3-pip \
69
+ gcc-multilib g++-multilib coreutils findutils grep sed
70
+ ```
71
+
72
+ Install BSWorld from PyPI. Add the `bumble` extra to run Bumble Hosts in tests:
73
+
74
+ ```sh
75
+ python3.12 -m pip install bsworld # or 'bsworld[bumble]'
76
+ ```
77
+
78
+ To develop BSWorld, clone it and install BSWorld and the bscontroller in the
79
+ repository from source:
80
+
81
+ ```sh
82
+ git clone https://github.com/XiaoMi/bsworld.git
83
+ cd bsworld
84
+ export BSWORLD_ROOT="$PWD"
85
+ python3.12 -m venv .venv
86
+ source .venv/bin/activate
87
+ python -m pip install -e components/bscontroller -e '.[test]'
88
+ ```
89
+
90
+ Run the development checks:
91
+
92
+ ```sh
93
+ ruff check src tests
94
+ pytest tests/unit -q
95
+ ```
96
+
97
+ #### Build and Test
98
+
99
+ Fetch the BabbleSim revisions selected by `components/babblesim.xml`:
100
+
101
+ ```sh
102
+ mkdir -p "$BSWORLD_ROOT/.cache/babblesim"
103
+ cd "$BSWORLD_ROOT/.cache/babblesim"
104
+ repo init --standalone-manifest --depth=1 -u "file://$BSWORLD_ROOT/components/babblesim.xml"
105
+ repo sync -c --no-tags
106
+ ```
107
+
108
+ Set the output paths and build every component:
109
+
110
+ ```sh
111
+ export BSIM_OUT_PATH="$PWD/build"
112
+ export BSIM_COMPONENTS_PATH="$PWD/components"
113
+ export BSIM_BUILD_FAIL_ASAP=1
114
+ make -j"$(nproc)" everything
115
+ ```
116
+
117
+ Run the Bumble scenarios on BSController, which need no other binaries:
118
+
119
+ ```sh
120
+ cd "$BSWORLD_ROOT"
121
+ pytest tests/integration/bumble -n auto -k '[bscontroller]'
122
+ ```
123
+
124
+ ### Test Controller Variants
125
+
126
+ Integration scenarios run with both the Zephyr Controller (`[zephyr]`) and Python BSController (`[bscontroller]`); `[zephyr]` cases are skipped when the Zephyr Controller is not built. See [Virtual Controllers](docs/controllers.md).
127
+
128
+ Select one implementation with its pytest parameter ID:
129
+
130
+ ```sh
131
+ pytest tests/integration -n auto -v -k '[zephyr]'
132
+ pytest tests/integration -n auto -v -k '[bscontroller]'
133
+ ```
134
+
135
+ ## Supported Integrations
136
+
137
+ | Environment | Validated behavior | Guide |
138
+ |---|---|---|
139
+ | Zephyr Bluetooth shell | Advertising and scanning, interference and recovery, connections and GATT, LL procedures, pairing and privacy, periodic advertising; complete firmware against Host-only shells on either Controller and against Bumble | [Zephyr tests](tests/integration/zephyr/README.md) |
140
+ | Bumble Python Host | Advertising, scanning, connections, periodic advertising and synchronization | [Bumble tests](tests/integration/bumble/README.md) |
141
+ | Linux and BlueZ under QEMU | Controller setup, advertising, scanning, connection and disconnection through the Linux Bluetooth subsystem | [BlueZ tests](tests/integration/qemu/bluez/README.md) |
142
+ | TrouBLE Rust Host | Advertising, connection, Battery Service discovery, reads and notifications | [TrouBLE tests](tests/integration/trouble/README.md) |
143
+ | NuttX BTSak | Advertising, scanning, multiple advertisers, interference and recovery | [BTSak tests](tests/integration/nuttx/btsak/README.md) |
144
+ | Apache NimBLE | Discovery, connection, GATT and subscription on NuttX; discovery and connection under QEMU | [NuttX tests](tests/integration/nuttx/nimble/README.md) · [QEMU tests](tests/integration/qemu/nimble/README.md) |
145
+
146
+ ## Technical Architecture
147
+
148
+ BSWorld keeps each Application and Host stack on its native interface. Every Host connects through standard HCI to an independent Zephyr Controller process or Python BSController worker. Complete Zephyr firmware includes its own Controller and radio and joins the PHY directly; see [Complete firmware](docs/writing-tests.md#complete-firmware). All Controllers, complete firmware and interference sources share the BabbleSim PHY and simulation clock.
149
+
150
+ <div align="center"><img src="docs/images/babblesim_arch.svg" alt="BSWorld participants connected through independent virtual Controllers or as complete firmware to a shared BabbleSim PHY" width="80%"><br><em>Figure 1: BSWorld architecture</em><br><br></div>
151
+
152
+ The virtual Controllers implement HCI commands, events, ACL data, Link Layer procedures, and radio transmission and reception. A topology can mix RTOS, Python, QEMU-based Linux and complete Zephyr participants with either Controller implementation. See [Virtual Controllers](docs/controllers.md) to choose and configure them.
153
+
154
+ HCI traffic is saved as `hciN.snoop` for Wireshark or another BTSnoop-capable tool. Radio traffic is saved as `babblesim/ellisys.bttrp` for Ellisys. See [Logs, traces, and captures](docs/artifacts.md) for locations and a recommended investigation order.
155
+
156
+ ### Discrete-Time Scheduling
157
+
158
+ | Time base | Meaning |
159
+ |---|---|
160
+ | **Simulation time** | Defines protocol timers, packet timing, RF events, asyncio waits, and test timeouts. It advances only after all participants synchronize. |
161
+ | **Wall-clock time** | Measures how long the test takes on the host. CPU load and Linux scheduling affect this duration but not protocol timing. |
162
+
163
+ BSWorld registers Applications, Controllers, interference devices, and pytest in the same simulation. A shared synchronization barrier keeps them on one timeline, so a protocol interval such as `T_IFS = 150 μs` remains 150 μs regardless of host load. After topology startup, standard `asyncio` waits and timeouts use simulation time; see [Async waiting and simulation time](docs/writing-tests.md#async-waiting-and-simulation-time).
164
+
165
+ Repeatability 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.
166
+
167
+ ## Documentation
168
+
169
+ - [Writing tests and RF scenarios](docs/writing-tests.md): define topologies, integrate Applications, wait with asyncio, and configure RF conditions.
170
+ - [Virtual Controllers](docs/controllers.md): choose between the Zephyr and Python Controllers, run a scenario against both, and configure BSController.
171
+ - [Logs, traces, and captures](docs/artifacts.md): locate and analyze test artifacts.
172
+ - [Development checks](docs/development.md): run unit tests, lint, and coverage.
173
+ - [Docker guide](docker/README.md): run published images, select suites, and build local images.
174
+
175
+ ## Community
176
+
177
+ - [Contributing](CONTRIBUTING.md)
178
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
179
+ - [Security Policy](SECURITY.md)
180
+
181
+ ## License
182
+
183
+ BSWorld is licensed under the [Apache License 2.0](LICENSE). Third-party components retain their own licenses; see [Third-Party Notices](THIRD_PARTY_NOTICES.md).