test: add riglink host-driven BLE round-trip test harness#216
Draft
buckleypaul wants to merge 3 commits into
Draft
test: add riglink host-driven BLE round-trip test harness#216buckleypaul wants to merge 3 commits into
buckleypaul wants to merge 3 commits into
Conversation
Extract the BLE advertisement reference crypto from tools/ble-adv.py into tools/hubble_ref_crypto.py and add build_advertisement() / decrypt_advertisement() helpers, so the host-driven riglink test can verify firmware output against a single pure-Python oracle rather than duplicating the on-wire format. ble-adv.py imports from the new module; its CLI behaviour is unchanged. Signed-off-by: Paul Buckley <paul@hubble.com>
The host-driven BLE test firmware and its serial transport depend on the riglink and jcon modules. Pull them in as workspace projects. Signed-off-by: Paul Buckley <paul@hubble.com>
Add a standalone Zephyr app plus a pytest harness that exercises the BLE advertisement API (include/hubble/ble.h) end to end over riglink: the host sets a known master key, a fixed (overridden) uptime, and a fixed sequence counter, asks the firmware to build an advertisement, then verifies it both byte-matches and decrypts against the reference oracle in tools/hubble_ref_crypto.py. No radio is used (CONFIG_BT=n); the same firmware runs on native_sim -- auto-built and launched by the harness over a pseudotty -- and on an attached nrf52840dk via --riglink-port. Transport is riglink's Zephyr shell backend: the shell owns the UART, so RX is interrupt-driven and won't drop bytes, and each command is dispatched as a subcommand of "rig" (the host targets it with shell_root="rig"). Determinism comes from overriding hubble_uptime_get() and hubble_sequence_counter_get() from the host, so a fixed uptime makes the derived time equal the provisioned epoch exactly. Requires the riglink fix that zeroes the dynamic command's arg counts in rig_dyn_get; without it the shell's argc precheck reads stack garbage and rejects commands with "wrong parameter count". Signed-off-by: Paul Buckley <paul@hubble.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/ble-adv.pyinto a reusabletools/hubble_ref_crypto.pymoduletests/riglink/) that exposes riglink RIG commands for initialising the SDK and retrieving BLE advertisementstests/riglink/python/) that connects to the device over pseudotty (native_sim) or UART (nrf52840dk), drives it via riglink, and validates advertisement payloads against the reference crypto implementationnative_sim/native/64for CI andnrf52840dk_nrf52840for hardware-in-the-loop testingriglinkandjconto the west manifestTest plan
west build -b native_sim/native/64 tests/riglinkpytest tests/riglink/python/ --riglink-port <pseudotty>--riglink-port /dev/ttyACM0test_ble.pypasses (BLE advertisement round-trip)test_reference.pypasses (reference crypto validation)