Skip to content

tdisp_proto: test typed extraction and protocol result handling - #5312

Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
microsoft:mainfrom
sunilmut:user/sunilmut/tdisp-proto-coverage-90
Open

Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
microsoft:mainfrom
sunilmut:user/sunilmut/tdisp-proto-coverage-90

Conversation

@sunilmut

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants