Fixed 2 warnings issued, revised report
This commit is contained in:
parent
3f3f3668f1
commit
36bc86baa9
5 changed files with 100 additions and 31 deletions
|
|
@ -1 +1,17 @@
|
||||||
This directory concerns the migration to C++ the ble-reticulum project.
|
This directory concerns the migration to C++ the ble-reticulum project.
|
||||||
|
|
||||||
|
## Test environment note
|
||||||
|
|
||||||
|
The project pytest configuration expects `pytest-asyncio`. 2 warning had issued, I had to rem the --disable-warnings flag in pytest.ini for the warnings to appear, when they appeared is became obvious that the absence of pytest-asyncio was creating the problem.
|
||||||
|
|
||||||
|
FIX: Install in the active virtual environment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 -m pip install pytest-asyncio
|
||||||
|
```
|
||||||
|
|
||||||
|
Equivalence test:
|
||||||
|
```bash
|
||||||
|
cd /usr/local/src/ble-reticulum
|
||||||
|
python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py -vv
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ Repository: /usr/local/src/ble-reticulum
|
||||||
```bash
|
```bash
|
||||||
cd /usr/local/src/ble-reticulum
|
cd /usr/local/src/ble-reticulum
|
||||||
python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py -vv
|
python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py -vv
|
||||||
Result
|
```
|
||||||
|
## Result
|
||||||
|
|
||||||
28 tests passed.
|
28 tests passed.
|
||||||
|
|
||||||
|
|
@ -18,28 +19,52 @@ Coverage Summary
|
||||||
|
|
||||||
The C++ implementation was compared against the existing Python implementation for:
|
The C++ implementation was compared against the existing Python implementation for:
|
||||||
|
|
||||||
BLEFragmenter single-fragment packets
|
``` bash
|
||||||
BLEFragmenter multi-fragment packets
|
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum $ cd /usr/local/src/ble-reticulum
|
||||||
MTU boundary sizes: 20, 23, 50, 185
|
python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py -vv
|
||||||
Empty and non-bytes packet errors
|
======================================================================================== test session starts ========================================================================================
|
||||||
BLEReassembler single-fragment reassembly
|
platform linux -- Python 3.13.12, pytest-9.0.3, pluggy-1.6.0 -- /home/jlpoole/rnsenv/bin/python3
|
||||||
BLEReassembler multi-fragment reassembly
|
cachedir: .pytest_cache
|
||||||
Out-of-order fragments with start first
|
rootdir: /usr/local/src/ble-reticulum
|
||||||
Malformed fragments
|
configfile: pytest.ini
|
||||||
Duplicate fragments with same data
|
plugins: anyio-4.12.1, asyncio-1.3.0
|
||||||
Duplicate fragments with different data
|
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
|
||||||
Stale buffer cleanup
|
collected 28 items
|
||||||
Statistics reset
|
|
||||||
Internal reassemble behavior
|
|
||||||
HDLC frame/deframe round trips
|
|
||||||
Full byte range HDLC round trip
|
|
||||||
Many HDLC round trips
|
|
||||||
Invalid HDLC escape sequences and frames
|
|
||||||
Non-bytes HDLC errors
|
|
||||||
Raw Result
|
|
||||||
|
|
||||||
28 passed, 2 warnings in 0.38s.
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_single_fragment_packets PASSED [ 3%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_multi_fragment_packets PASSED [ 7%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_mtu_boundary_sizes[20] PASSED [ 10%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_mtu_boundary_sizes[23] PASSED [ 14%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_mtu_boundary_sizes[50] PASSED [ 17%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_mtu_boundary_sizes[185] PASSED [ 21%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEFragmenterCppEquivalence::test_empty_and_non_bytes_packet_errors PASSED [ 25%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_single_fragment_reassembly PASSED [ 28%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_multi_fragment_reassembly PASSED [ 32%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_out_of_order_fragments_with_start_first PASSED [ 35%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_malformed_fragments PASSED [ 39%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_duplicate_fragments_same_data PASSED [ 42%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_duplicate_fragments_different_data PASSED [ 46%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_stale_buffer_cleanup PASSED [ 50%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_statistics_reset PASSED [ 53%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestBLEReassemblerCppEquivalence::test_internal_reassemble_method_matches_python PASSED [ 57%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_frame_deframe_round_trips[] PASSED [ 60%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_frame_deframe_round_trips[Hello, World!] PASSED [ 64%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_frame_deframe_round_trips[~\x01~] PASSED [ 67%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_frame_deframe_round_trips[}\x02}] PASSED [ 71%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_frame_deframe_round_trips[\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff] PASSED [ 75%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_many_hdlc_round_trips PASSED [ 78%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_invalid_hdlc_escape_sequences_and_frames[] PASSED [ 82%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_invalid_hdlc_escape_sequences_and_frames[~] PASSED [ 85%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_invalid_hdlc_escape_sequences_and_frames[missing-flags] PASSED [ 89%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_invalid_hdlc_escape_sequences_and_frames[~\x01~~] PASSED [ 92%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_invalid_hdlc_escape_sequences_and_frames[~}~] PASSED [ 96%]
|
||||||
|
migration/tests/test_fragmentation_cpp_equivalence.py::TestHDLCFramerCppEquivalence::test_non_bytes_errors PASSED [100%]
|
||||||
|
|
||||||
Interpretation
|
======================================================================================== 28 passed in 0.43s =========================================================================================
|
||||||
|
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum $
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Interpretation
|
||||||
|
|
||||||
This establishes phase-1 behavioral equivalence for the protocol-core fragmentation/reassembly layer. The C++ code is not yet integrated into BLEInterface.py for live Reticulum/BLE traffic.
|
This establishes phase-1 behavioral equivalence for the protocol-core fragmentation/reassembly layer. The C++ code is not yet integrated into BLEInterface.py for live Reticulum/BLE traffic.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
UPDATE symbols
|
||||||
|
SET status = 'TESTED',
|
||||||
|
phase = '1_protocol_core',
|
||||||
|
notes = COALESCE(notes, '') || char(10) ||
|
||||||
|
'2026-05-16: C++ equivalence tests passed: 28 tests in migration/tests/test_fragmentation_cpp_equivalence.py.'
|
||||||
|
WHERE source_file = 'src/ble_reticulum/BLEFragmentation.py'
|
||||||
|
AND symbol_name IN (
|
||||||
|
'BLEFragmenter',
|
||||||
|
'__init__',
|
||||||
|
'fragment_packet',
|
||||||
|
'get_fragment_overhead',
|
||||||
|
'BLEReassembler',
|
||||||
|
'receive_fragment',
|
||||||
|
'_reassemble',
|
||||||
|
'cleanup_stale_buffers',
|
||||||
|
'get_statistics',
|
||||||
|
'reset_statistics',
|
||||||
|
'HDLCFramer',
|
||||||
|
'frame_packet',
|
||||||
|
'deframe_packet'
|
||||||
|
);
|
||||||
|
|
@ -64,10 +64,14 @@ package-dir = {"" = "src"}
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
"ble_reticulum" = ["*.py"]
|
"ble_reticulum" = ["*.py"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
#
|
||||||
testpaths = ["tests"]
|
# 5/16/26 jlpoole: remming to stop warning
|
||||||
python_files = ["test_*.py"]
|
# (WARNING: ignoring pytest config in pyproject.toml!)
|
||||||
python_classes = ["Test*"]
|
#
|
||||||
python_functions = ["test_*"]
|
#[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
#testpaths = ["tests"]
|
||||||
addopts = "-v --tb=short"
|
#python_files = ["test_*.py"]
|
||||||
|
#python_classes = ["Test*"]
|
||||||
|
#python_functions = ["test_*"]
|
||||||
|
#asyncio_mode = "auto"
|
||||||
|
#addopts = "-v --tb=short"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ addopts =
|
||||||
-v
|
-v
|
||||||
--strict-markers
|
--strict-markers
|
||||||
--tb=short
|
--tb=short
|
||||||
--disable-warnings
|
#
|
||||||
|
# 5/16/26 jlpoole: we want the warnings for the C++ migration
|
||||||
|
# so next line is rem'd out
|
||||||
|
#--disable-warnings
|
||||||
# Legacy tests with import issues - run explicitly if needed
|
# Legacy tests with import issues - run explicitly if needed
|
||||||
--ignore=tests/test_bleak_threading_hang.py
|
--ignore=tests/test_bleak_threading_hang.py
|
||||||
--ignore=tests/test_bleak_with_exec_loading.py
|
--ignore=tests/test_bleak_with_exec_loading.py
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue