8
8
9
9
import pytest
10
10
11
- import framework .utils_cpuid as cpuid_utils
12
11
from framework .properties import global_props
12
+ from framework .utils_cpuid import CpuModel , CpuVendor , get_cpu_vendor
13
13
14
14
# All existing CPU templates available on Intel
15
15
INTEL_TEMPLATES = ["C3" , "T2" , "T2CL" , "T2S" ]
@@ -24,23 +24,20 @@ def get_supported_cpu_templates():
24
24
Return the list of CPU templates supported by the platform.
25
25
"""
26
26
# pylint:disable=too-many-return-statements
27
- match cpuid_utils .get_cpu_vendor ():
28
- case cpuid_utils .CpuVendor .INTEL :
29
- # T2CL template is only supported on Cascade Lake and newer CPUs.
30
- if global_props .cpu_codename == cpuid_utils .CpuModel .INTEL_SKYLAKE :
31
- return sorted (set (INTEL_TEMPLATES ) - set (["T2CL" ]))
27
+ host_linux = global_props .host_linux_version_tpl
28
+
29
+ match get_cpu_vendor (), global_props .cpu_codename :
30
+ # T2CL template is only supported on Cascade Lake and newer CPUs.
31
+ case CpuVendor .INTEL , CpuModel .INTEL_SKYLAKE :
32
+ return sorted (set (INTEL_TEMPLATES ) - set (["T2CL" ]))
33
+ case CpuVendor .INTEL , _:
32
34
return INTEL_TEMPLATES
33
- case cpuid_utils . CpuVendor .AMD :
35
+ case CpuVendor .AMD , _ :
34
36
return AMD_TEMPLATES
35
- case cpuid_utils .CpuVendor .ARM :
36
- if global_props .host_linux_version_tpl < (6 , 1 ):
37
- return []
38
- match global_props .cpu_model :
39
- case cpuid_utils .CpuModel .ARM_NEOVERSE_N1 :
40
- return []
41
- case cpuid_utils .CpuModel .ARM_NEOVERSE_V1 :
42
- return ARM_TEMPLATES
43
- return []
37
+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_V1 if host_linux >= (6 , 1 ):
38
+ return ARM_TEMPLATES
39
+ case _:
40
+ return []
44
41
45
42
46
43
SUPPORTED_CPU_TEMPLATES = get_supported_cpu_templates ()
@@ -57,23 +54,22 @@ def get_supported_custom_cpu_templates():
57
54
"""
58
55
Return the list of custom CPU templates supported by the platform.
59
56
"""
57
+ host_linux = global_props .host_linux_version_tpl
60
58
61
- match cpuid_utils . get_cpu_vendor ():
62
- case cpuid_utils . CpuVendor . INTEL :
63
- # T2CL template is only supported on Cascade Lake and newer CPUs.
64
- if global_props . cpu_codename == cpuid_utils . CpuModel . INTEL_SKYLAKE :
65
- return set ( INTEL_TEMPLATES ) - { "T2CL" }
59
+ match get_cpu_vendor (), global_props . cpu_codename :
60
+ # T2CL template is only supported on Cascade Lake and newer CPUs.
61
+ case CpuVendor . INTEL , CpuModel . INTEL_SKYLAKE :
62
+ return set ( INTEL_TEMPLATES ) - { "T2CL" }
63
+ case CpuVendor . INTEL , _:
66
64
return INTEL_TEMPLATES
67
- case cpuid_utils . CpuVendor .AMD :
65
+ case CpuVendor .AMD , _ :
68
66
return AMD_TEMPLATES
69
- case cpuid_utils .CpuVendor .ARM :
70
- if global_props .host_linux_version_tpl < (6 , 1 ):
71
- return []
72
- match global_props .cpu_model :
73
- case cpuid_utils .CpuModel .ARM_NEOVERSE_N1 :
74
- return AARCH64_CUSTOM_CPU_TEMPLATES_G2
75
- case cpuid_utils .CpuModel .ARM_NEOVERSE_V1 :
76
- return AARCH64_CUSTOM_CPU_TEMPLATES_G3
67
+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_N1 if host_linux >= (6 , 1 ):
68
+ return AARCH64_CUSTOM_CPU_TEMPLATES_G2
69
+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_V1 if host_linux >= (6 , 1 ):
70
+ return AARCH64_CUSTOM_CPU_TEMPLATES_G3
71
+ case _:
72
+ return []
77
73
78
74
79
75
def custom_cpu_templates_params ():
0 commit comments