test: fix test aborts and hardware-dependent failures on single-core machines - #1474
Open
iamjaeholee wants to merge 2 commits into
Open
test: fix test aborts and hardware-dependent failures on single-core machines#1474iamjaeholee wants to merge 2 commits into
iamjaeholee wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1474 +/- ##
==========================================
+ Coverage 79.38% 79.53% +0.14%
==========================================
Files 39 39
Lines 5592 5589 -3
==========================================
+ Hits 4439 4445 +6
+ Misses 1153 1144 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Resolves #1473
Description
This PR fixes two test suite issues that cause
cargo test --bin uhyveto fail prematurely on single-core machines.Changes Made
1. Fixed graceful exit replacing
panic!in affinity validationThe
test_affinity_errors_when_lacking_cpu_corestest relies on#[should_panic].When running on a machine with fewer cores than requested,
affinity.validate()fails. However, instead of panicking,clapgracefully terminates the process viaapp.error().exit().Fix: Added
#[cfg(test)] panic!("{e}");to theValueValidationerror block to properly satisfy the test harness.2. Removed hardware-dependent logic from TOML parsing tests
Fixing the above bug exposed a flaw in
test_toml_affinity_stringsandtest_toml_affinity_usize_array. Both tests explicitly request 3 cores (affinity = '0-1,2') and then callget_affinity()to verify logic validation. However, this implicitly triggers the hardware validation check first, which unconditionally panics on single/dual-core machines.Fix: Removed the
get_affinity()calls from these TOML tests, as the TOML deserialization itself is already verified viaassert_eq!.