The wire protocol is re-specified as DongLoRa Protocol v2 (see PROTOCOL.md). Every type_id, tag-correlation rule, and field layout is incompatible with 0.1.0. * Add PROTOCOL.md as the normative spec for the v2 wire format. * Replace framing.rs with a streaming FrameDecoder that emits (type_id, tag, payload) triples on each COBS-delimited, CRC-checked frame. * Split the single-file lib.rs into dedicated modules: frame, commands, events, errors, modulation, info, crc, chip_id. Re-exports preserve convenience imports at the crate root. * Replace RadioConfig / Bandwidth with a Modulation enum covering LoRa, FSK/GFSK, LR-FHSS, and FLRC, each with its own typed parameter struct. * Add TxFlags, RxOrigin, SetConfigResult, OkPayload to model v2 response shapes, and RadioChipId for GET_INFO. * Rewrite fuzz corpus: replace the 4 cobs_* / command_roundtrip targets with decoder_feed, frame_roundtrip, lora_config_roundtrip, and parse_device_message; drop parse_radio_config. * Expand proptest and mutation-killer coverage for the new wire shape. * Rewrite canonical-byte test vectors against the v2 spec.
83 lines
2.6 KiB
Makefile
83 lines
2.6 KiB
Makefile
# donglora-protocol development tasks
|
|
|
|
# default: list all recipes
|
|
default:
|
|
@just --list
|
|
|
|
# run ALL quality gates (tests, clippy, fmt, doc, deny, fuzz, miri, mutants)
|
|
test: test-unit test-clippy test-fmt test-doc test-deny test-fuzz test-miri test-mutants
|
|
|
|
# quick compile check (all feature permutations)
|
|
check:
|
|
cargo check
|
|
cargo check --no-default-features
|
|
cargo check --all-features
|
|
|
|
# unit + proptest + doc tests
|
|
test-unit:
|
|
cargo nextest run
|
|
cargo nextest run --no-default-features
|
|
cargo nextest run --all-features
|
|
cargo test --doc
|
|
|
|
# clippy with warnings as errors across feature permutations
|
|
test-clippy:
|
|
cargo clippy --all-targets -- -D warnings
|
|
cargo clippy --all-targets --no-default-features -- -D warnings
|
|
cargo clippy --all-targets --all-features -- -D warnings
|
|
|
|
# check formatting
|
|
test-fmt:
|
|
cargo fmt -- --check
|
|
|
|
# doc build (catches broken doc links)
|
|
test-doc:
|
|
cargo doc --no-deps --all-features
|
|
|
|
# license and advisory audit
|
|
test-deny:
|
|
cargo deny check
|
|
|
|
# fuzz every target for 60s (requires nightly + cargo-fuzz)
|
|
test-fuzz:
|
|
cd fuzz && cargo +nightly fuzz run decoder_feed -- -max_total_time=60
|
|
cd fuzz && cargo +nightly fuzz run parse_command -- -max_total_time=60
|
|
cd fuzz && cargo +nightly fuzz run parse_device_message -- -max_total_time=60
|
|
cd fuzz && cargo +nightly fuzz run frame_roundtrip -- -max_total_time=60
|
|
cd fuzz && cargo +nightly fuzz run lora_config_roundtrip -- -max_total_time=60
|
|
|
|
# run tests under miri (catches UB, requires nightly + miri component)
|
|
# The proptest suite is skipped — its file-persistence layer calls getcwd
|
|
# which miri does not support. Vectors and unit tests run clean.
|
|
test-miri:
|
|
cargo +nightly miri nextest run --lib --test vectors
|
|
cargo +nightly miri nextest run --lib --test vectors --no-default-features
|
|
|
|
# mutation testing (requires cargo-mutants).
|
|
#
|
|
# Runs under both feature configurations so that feature-gated paths
|
|
# (currently only the defmt::Format derives) are covered in both shapes.
|
|
# No exclusions yet for the v1.0 codec — rerun mutation testing on a
|
|
# fresh target and add `-E` lines here for any provably-equivalent
|
|
# mutants that survive, with a comment explaining why.
|
|
test-mutants: test-mutants-default test-mutants-no-default
|
|
|
|
test-mutants-default:
|
|
cargo mutants --no-shuffle --test-tool=nextest
|
|
|
|
test-mutants-no-default:
|
|
cargo mutants --no-shuffle --test-tool=nextest --no-default-features
|
|
|
|
# format code
|
|
fmt:
|
|
cargo fmt
|
|
|
|
# build in release mode
|
|
build:
|
|
cargo build --release
|
|
|
|
# clean all build artifacts
|
|
clean:
|
|
cargo clean
|
|
rm -rf fuzz/target fuzz/corpus fuzz/artifacts
|