-
Couldn't load subscription status.
- Fork 2.1k
test: Add tests for multi-vCPU setup #4942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """ | ||
| Test all vCPUs are configured correctly and work properly. | ||
|
|
||
| This test suite aims to catch bugs of Firecracker's vCPU configuration and | ||
| CPU templates especially under multi-vCPU setup, by checking that all vCPUs | ||
| are operating identically, except for the expected differences. | ||
| """ | ||
|
|
||
| import pytest | ||
|
|
||
| # Use the maximum number of vCPUs supported by Firecracker | ||
| MAX_VCPUS = 32 | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("vcpu_count", [MAX_VCPUS]) | ||
| def test_all_vcpus_online(uvm_any): | ||
zulinx86 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """Check all vCPUs are online inside guest""" | ||
| assert ( | ||
| uvm_any.ssh.check_output("cat /sys/devices/system/cpu/online").stdout.strip() | ||
| == f"0-{uvm_any.vcpus_count - 1}" | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("vcpu_count", [MAX_VCPUS]) | ||
| def test_all_vcpus_have_same_features(uvm_any): | ||
| """ | ||
| Check all vCPUs have the same features inside guest. | ||
|
|
||
| This test ensures Firecracker or CPU templates don't configure CPU features | ||
| differently between vCPUs. | ||
|
|
||
| Note that whether the shown CPU features are expected or not should be | ||
| tested in (arch-specific) test_cpu_features_*.py only for vCPU 0. Thus, we | ||
| only test the equivalence of all CPUs in the same guest. | ||
| """ | ||
| # Get a feature set for each CPU and deduplicate them. | ||
| unique_feature_lists = uvm_any.ssh.check_output( | ||
| 'grep -E "^(flags|Features)" /proc/cpuinfo | uniq' | ||
| ).stdout.splitlines() | ||
| assert len(unique_feature_lists) == 1 | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.