Files
pyxis/tests
Torlando a1c2ec8569 fix(lxmf): set send marker in the LVGL lock section (close completion race)
Greptile round on ba5af76 (4/5) correctly rejected the first attempt:
the submitted-text marker was assigned in ChatScreen::on_send_clicked
AFTER the mailbox publish returned, so the main loop could take() +
admit the send and enter clear_composer() while the marker was still
empty — neither clearing the submitted text nor associating the commit
with its submission.

The marker is now recorded by the send callback itself
(UIManager::on_send_message_from_chat) immediately after the mailbox
accept, in the same LVGL lock section as the publish. The click handler
runs on the LVGL task with the LVGL mutex held (LVGLInit.cpp:160-179
wraps the whole lv_task_handler in the recursive mutex), so the marker
is visible to the main loop only after the mailbox entry is — the
take() + admit + clear sequence can never observe an empty marker for
an accepted send. clear_composer() additionally no-ops on an empty
marker, which is the retained-text path for rejected/retry sends.

The contract test is tightened to assert the marker is NOT assigned in
the click handler and IS assigned in the callback, so the race cannot
silently regress.

Verification: 181/181 contracts, tdeck + tdeck-release green.
2026-09-07 01:16:34 +00:00
..

Pyxis Tests

Three test surfaces, each runnable independently.

1. Pyxis-unique pytest suite

Native C++ tests of pyxis-unique code (BLE fragmenter, HDLC, etc.) and Python tests of build scripts.

/usr/bin/python3 -m pytest tests/build_scripts tests/native -v

System Python 3.9 has pytest pre-installed; Homebrew Python does not.

  • build_scripts/test_patch_nimble.py — verifies patch_nimble.py idempotency, drift detection, missing-file handling
  • build_scripts/test_patch_littlefs_paths.py — verifies non-destructive LittleFS mounting, patch idempotency/drift handling, and persistent-partition isolation
  • native/test_hdlc.{cpp,py} — HDLC escape/unescape/frame round-trip + golden vector against Python RNS
  • native/test_ble_fragmenter.{cpp,py} — BLEFragmenter ↔ BLEReassembler: in-order, out-of-order, duplicate, dropped+timeout, per-peer isolation, MTU change
  • native/test_ble_peer_manager.{cpp,py} — connection-map state machine: discover, identity promotion, blacklist, handle map cleanup, MAC rotation, pool exhaustion
  • native/test_ble_operation_queue.{cpp,py} — GATT op queue: FIFO, busy-state, timeout, clearForConnection, builder
  • native/test_ring_buffers.{cpp,py} — PCM + encoded SPSC ring buffers, including 100k-frame multithreaded producer/consumer stress
  • native/test_audio_filters.{cpp,py} — VoiceFilterChain frequency response, peak limiting, multichannel
  • native/test_call_command_mailbox.{cpp,py} — generation-scoped LXST hangup/mute command handoff and producer/consumer stress
  • native/test_call_start_mailbox.{cpp,py} — exact 16-byte LXST outgoing-call handoff, duplicate rejection, and reusable producer/consumer stress
  • native/test_call_generation_guard.{cpp,py} — atomic, generation-scoped call admission, stale-owner protection, and repeated two-thread reservation races
  • native/test_call_link_ownership.{cpp,py} — exact 128-bit LXST link ownership publication, mixed-ID publication stress, and generation-bound deferred-close concurrency
  • native/test_lxst_signal_parser.{cpp,py} — bounded MessagePack parsing for legacy one-signal and current LXST profile+duplex signalling arrays

Adding a new native C++ test

Pattern: pure C++ unit + thin pytest wrapper.

  1. Write tests/native/test_<thing>.cpp — include from ../../{src,lib/...} for the unit under test, use the existing EXPECT_EQ/EXPECT_TRUE/RUN(name) framework, return non-zero on any failure.
  2. If the unit pulls in microReticulum types, the shims in tests/native/ cover what's been needed so far:
    • Bytes.h → bytes_shim.h (minimal RNS::Bytes — append/data/size/writable/resize/mid)
    • Log.h (no-op TRACE/WARNING/INFO/ERROR macros)
    • Utilities/OS.h (OS::time() with set_fake_time()/clear_fake_time())
  3. Write tests/native/test_<thing>.py — copy the test_hdlc.py template, swap source/include paths, run.
  4. Confirm: /usr/bin/python3 -m pytest tests/native/test_<thing>.py -v

2. LXST audio interop tests

Python tests verifying wire format and codec compatibility between pyxis (C++), Python LXST, and LXST-kt (Kotlin).

/usr/bin/python3 -m pytest tests/interop -v

Requires pycodec2 and access to $HOME/repos/public/LXST.

3. microReticulum native unit tests (PlatformIO)

The fork's microReticulum tests live under deps/microReticulum/test/ and run via PlatformIO Unity.

cd deps/microReticulum && pio test -e native17

Use native17, not native — the C++11 env is broken (static-constexpr ODR-use). Baseline as of 2026-05-02: 94/114 PASS, 7 FAIL, 5 SKIPPED, 7 suites ERRORED. The clean suites are test_os, test_bytes, test_msgpack, test_crypto, test_filesystem, test_objects, test_interop, test_general, test_reference, test_example, test_collections.