Repository navigation
tdisp_proto: test typed extraction and protocol result handling - #5312
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Conversation
Test all six typed response variants, command protobuf round trips, before/after state validation, exact error mappings and failure precedence. Decode independent wire fixtures to check unknown fields and statuses. No production behavior or protobuf schema changes. Baseline unavailable: no existing unit tests. Complete Linux x64 all-features passing-test classified production coverage: After: 90.52% (105/116), 5 passing tests, none ignored. These synthetic packets do not validate execution against a real host.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The failure-case tests omit mismatched and absent Bind payloads, leaving protocol-error precedence unprotected against regressions.
1 open issue
What changed in this PR
This PR adds unit tests for tdisp_proto response helpers and protobuf transport handling, without changing production behavior or the schema.
Changes:
- Tests all six typed response variants and command round trips.
- Checks state validation, error mappings, failure handling, and independent wire fixtures with unknown fields and statuses.
- Registers the test module and adds tracing support for tests.
| File | Description |
|---|---|
vm/devices/tdisp_proto/src/tests.rs |
Adds five tests covering protocol helpers and wire handling. |
vm/devices/tdisp_proto/src/lib.rs |
Registers the test-only module. |
vm/devices/tdisp_proto/Cargo.toml |
Adds the tracing test dependency. |
Cargo.lock |
Records the added dependency for tdisp_proto. |
Review effort: Balanced
Comment on lines
+182
to
+191
| let response = GuestToHostResponse { | ||
| result: code as i32, | ||
| response: Some(Response::Bind(TdispCommandResponseBind {})), | ||
| ..Default::default() | ||
| }; | ||
| assert_eq!(response.error_code(), Some(code)); | ||
| assert!(matches!( | ||
| response.response::<TdispCommandResponseBind>(), | ||
| Err(TdispGuestOperationError::$name) | ||
| )); |
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.

Test all six typed response variants, command protobuf round trips,
before/after state validation, exact error mappings and failure precedence.
Decode independent wire fixtures to check unknown fields and statuses.
No production behavior or protobuf schema changes.
Baseline unavailable: no existing unit tests.
Complete Linux x64 all-features passing-test classified production coverage:
After: 90.52% (105/116), 5 passing tests, none ignored.
These synthetic packets do not validate execution against a real host.