Skip to content

test: add riglink host-driven BLE round-trip test harness#216

Draft
buckleypaul wants to merge 3 commits into
HubbleNetwork:mainfrom
buckleypaul:test/riglink-ble
Draft

test: add riglink host-driven BLE round-trip test harness#216
buckleypaul wants to merge 3 commits into
HubbleNetwork:mainfrom
buckleypaul:test/riglink-ble

Conversation

@buckleypaul

Copy link
Copy Markdown
Collaborator

Summary

  • Factors Hubble reference crypto out of tools/ble-adv.py into a reusable tools/hubble_ref_crypto.py module
  • Adds a Zephyr firmware target (tests/riglink/) that exposes riglink RIG commands for initialising the SDK and retrieving BLE advertisements
  • Adds a Python test suite (tests/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 implementation
  • Supports native_sim/native/64 for CI and nrf52840dk_nrf52840 for hardware-in-the-loop testing
  • Adds riglink and jcon to the west manifest

Test plan

  • Build firmware for native_sim: west build -b native_sim/native/64 tests/riglink
  • Run pytest against native_sim: pytest tests/riglink/python/ --riglink-port <pseudotty>
  • Build and flash nrf52840dk firmware, run pytest with --riglink-port /dev/ttyACM0
  • Confirm test_ble.py passes (BLE advertisement round-trip)
  • Confirm test_reference.py passes (reference crypto validation)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants