Skip to content

Comments

Doc test fix#35

Merged
ming1 merged 3 commits intomainfrom
doc-test-fix
Sep 17, 2025
Merged

Doc test fix#35
ming1 merged 3 commits intomainfrom
doc-test-fix

Conversation

@ming1
Copy link
Collaborator

@ming1 ming1 commented Sep 17, 2025

No description provided.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
The test was failing because it counted all existing ublk devices in the system,
including devices from other tests that might have stale device paths.

Changes:
- Modified __test_ublk_session to accept FnMut closure for capturing device ID
- Updated test to capture the specific device ID of the device it creates
- Changed test logic to only count the device with the captured ID
- Simplified shared state using Arc<Mutex<i32>> with -1 as uninitialized marker
- Assert exact count (1) instead of just > 0 for more precise validation

This makes the test robust against interference from other test devices
and prevents failures when accessing non-existent device paths.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
@ming1 ming1 merged commit 3c5b86c into main Sep 17, 2025
8 checks passed
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.

1 participant