Skip to content

Commit 2862941

Browse files
committed
chore: Use uppercase for custom CPU templates
While we use uppercase for static CPU templates (and have to do so to follow the API specification), we used lowercase for custom CPU templates. Using uppercase for both will make integration tests that support both types simpler. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 98aa435 commit 2862941

File tree

13 files changed

+19
-19
lines changed

13 files changed

+19
-19
lines changed

src/vmm/src/cpu_config/aarch64/static_cpu_templates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mod tests {
3939

4040
#[test]
4141
fn verify_consistency_with_json_templates() {
42-
let static_templates = [(v1n1::v1n1(), "v1n1.json")];
42+
let static_templates = [(v1n1::v1n1(), "V1N1.json")];
4343

4444
for (hardcoded_template, filename) in static_templates {
4545
let json_template = get_json_template(filename);

src/vmm/src/cpu_config/x86_64/static_cpu_templates/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ mod tests {
8484
#[test]
8585
fn verify_consistency_with_json_templates() {
8686
let static_templates = [
87-
(c3::c3(), "c3.json"),
88-
(t2::t2(), "t2.json"),
89-
(t2s::t2s(), "t2s.json"),
90-
(t2cl::t2cl(), "t2cl.json"),
91-
(t2a::t2a(), "t2a.json"),
87+
(c3::c3(), "C3.json"),
88+
(t2::t2(), "T2.json"),
89+
(t2s::t2s(), "T2S.json"),
90+
(t2cl::t2cl(), "T2CL.json"),
91+
(t2a::t2a(), "T2A.json"),
9292
];
9393

9494
for (hardcoded_template, filename) in static_templates {

tests/framework/microvm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,11 +802,11 @@ def set_cpu_template(self, cpu_template):
802802
# static CPU template
803803
if isinstance(cpu_template, str):
804804
self.api.machine_config.patch(cpu_template=cpu_template)
805-
self.cpu_template_name = cpu_template.lower()
805+
self.cpu_template_name = cpu_template
806806
# custom CPU template
807807
elif isinstance(cpu_template, dict):
808808
self.api.cpu_config.put(**cpu_template["template"])
809-
self.cpu_template_name = cpu_template["name"].lower()
809+
self.cpu_template_name = cpu_template["name"]
810810

811811
def add_drive(
812812
self,

tests/framework/utils_cpu_templates.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ def get_supported_custom_cpu_templates():
5555
case CpuVendor.AMD, CpuModel.AMD_MILAN:
5656
return AMD_TEMPLATES
5757
case CpuVendor.ARM, CpuModel.ARM_NEOVERSE_N1 if host_linux >= (6, 1):
58-
return ["v1n1"]
58+
return ["V1N1"]
5959
case CpuVendor.ARM, CpuModel.ARM_NEOVERSE_V1 if host_linux >= (6, 1):
60-
return ["v1n1", "aarch64_with_sve_and_pac"]
60+
return ["V1N1", "AARCH64_WITH_SVE_AND_PAC"]
6161
case CpuVendor.ARM, CpuModel.ARM_NEOVERSE_V1:
62-
return ["aarch64_with_sve_and_pac"]
62+
return ["AARCH64_WITH_SVE_AND_PAC"]
6363
case CpuVendor.ARM, CpuModel.ARM_NEOVERSE_V2:
64-
return ["aarch64_with_sve_and_pac"]
64+
return ["AARCH64_WITH_SVE_AND_PAC"]
6565
case _:
6666
return []
6767

6868

6969
def custom_cpu_templates_params():
7070
"""Return Custom CPU templates as pytest parameters"""
7171
for name in sorted(get_supported_custom_cpu_templates()):
72-
tmpl = Path(f"./data/custom_cpu_templates/{name.lower()}.json")
72+
tmpl = Path(f"./data/custom_cpu_templates/{name}.json")
7373
yield pytest.param(
7474
{"name": name, "template": json.loads(tmpl.read_text("utf-8"))},
7575
id="custom_" + name,

tests/integration_tests/functional/test_cpu_features_aarch64.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ def test_guest_cpu_features(uvm_any):
3737
vm = uvm_any
3838
expected_cpu_features = set()
3939
match global_props.cpu_model, vm.cpu_template_name:
40-
case CpuModel.ARM_NEOVERSE_N1, "v1n1":
40+
case CpuModel.ARM_NEOVERSE_N1, "V1N1":
4141
expected_cpu_features = G2_FEATS
4242
case CpuModel.ARM_NEOVERSE_N1, None:
4343
expected_cpu_features = G2_FEATS
4444

4545
# [cm]7g with guest kernel 5.10 and later
46-
case CpuModel.ARM_NEOVERSE_V1, "v1n1":
46+
case CpuModel.ARM_NEOVERSE_V1, "V1N1":
4747
expected_cpu_features = G2_FEATS
48-
case CpuModel.ARM_NEOVERSE_V1, "aarch64_with_sve_and_pac":
48+
case CpuModel.ARM_NEOVERSE_V1, "AARCH64_WITH_SVE_AND_PAC":
4949
expected_cpu_features = G3_FEATS | G3_SVE_AND_PAC
5050
case CpuModel.ARM_NEOVERSE_V1, None:
5151
expected_cpu_features = G3_FEATS
5252
case CpuModel.ARM_NEOVERSE_V2, None:
5353
expected_cpu_features = G4_FEATS
54-
case CpuModel.ARM_NEOVERSE_V2, "aarch64_with_sve_and_pac":
54+
case CpuModel.ARM_NEOVERSE_V2, "AARCH64_WITH_SVE_AND_PAC":
5555
expected_cpu_features = G4_FEATS | G4_SVE_AND_PAC
5656

5757
guest_feats = set(vm.ssh.check_output(CPU_FEATURES_CMD).stdout.split())

tests/integration_tests/security/test_vulnerabilities.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def get_vuln_files_exception_dict(template):
166166
# Since those bits are not set on Intel Skylake and C3 template makes guests pretend to be AWS
167167
# C3 instance (quite old processor now) by overwriting CPUID.1H:EAX, it is impossible to avoid
168168
# this "Unknown" state.
169-
if global_props.cpu_codename == "INTEL_SKYLAKE" and template == "c3":
169+
if global_props.cpu_codename == "INTEL_SKYLAKE" and template == "C3":
170170
exception_dict["mmio_stale_data"] = "Unknown: No mitigations"
171-
elif global_props.cpu_codename == "INTEL_SKYLAKE" or template == "t2s":
171+
elif global_props.cpu_codename == "INTEL_SKYLAKE" or template == "T2S":
172172
exception_dict["mmio_stale_data"] = "Clear CPU buffers"
173173

174174
return exception_dict

0 commit comments

Comments
 (0)