Testing framework refactor#983
Draft
HaoboGu wants to merge 9 commits into
Draft
Conversation
The simulator commits were authored against an older rynk base; feat/rynk has since changed several APIs. Port the rebased suite so it builds and passes: - KeyAction::TapHold now takes a u8 profile index (was an inline MorseProfile). Register per-key profiles via a new SimKeyboardBuilder::morse_profiles table and reference them by index; combo-only keys use u8::MAX (default profile). - The rynk HostService dispatch is now session-scoped and private. Expose new_session()/dispatch() as pub(crate) and give the simulator one persistent RynkSession, like a single host connection. - ConsumerKey discriminants are no longer USB usage codes; use u16::from(..) to match the report the keyboard emits. - bulk is folded into rynk (no standalone feature); drop the dead cfg(feature = "bulk") gates and size the loopback bulk fixture at 256 keys.
The struct-literal rewrite of the rynk service's test config was unrelated cleanup that drifted into the simulator branch. Restore it to the base form so this PR touches only simulator-relevant lines.
Drive Vial through the existing process_via_packet (now pub(crate)) instead of a new process_packet wrapper. ViaReport is already public, so the sim builds the report itself and run_session returns to its base form.
The simulator lived in src/ as a std-gated `pub mod sim` so it could reach pub(crate) internals, putting ~1.1k lines of test harness in the shipping crate. Move it to tests/common/sim, where it drives only rmk's public API: - Vial/Rynk now go through the public `run_session` over in-memory pipes (the rynk_link pattern), so host/via and host/rynk revert to base — the pub(crate) seams are gone. - A std-gated #[doc(hidden)] `rmk::test_exports` wraps the few internal signals the harness still needs (flash/connection/keycode). std is dev-only, so the firmware API is unchanged. - src/test_support.rs regains its own block_on (src unit tests can't reach the test crate); check_sim_tests.sh skips the harness itself. Whole feature matrix passes (scripts/test_all.sh).
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.
No description provided.