Skip to content

Commit

Permalink
utils/cpu: Add support for Power11 architecture
Browse files Browse the repository at this point in the history
This commit enhances the CPU utility to support the Power11
architecture by making pattern matching case-insensitive.

Signed-off-by: Disha Goel <[email protected]>
  • Loading branch information
disgoel committed Aug 2, 2024
1 parent 698e9d3 commit 5441d6d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion avocado/utils/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ibm": (
rb"POWER\d",
rb"IBM/S390",
rb"Power\d",
),
}

Expand Down Expand Up @@ -216,6 +217,7 @@ def get_arch():
]
cpuinfo = _get_info()
for pattern, arch in cpu_table:
pattern = re.compile(pattern, re.IGNORECASE)
if _list_matches(cpuinfo, pattern):
if arch == "arm":
# ARM is a special situation, which matches both 32 bits
Expand Down Expand Up @@ -261,7 +263,7 @@ def get_family():
res = []
try:
for line in _get_info():
res = re.findall(rb"cpu\s+:\s+(POWER\d+)", line)
res = re.findall(rb"cpu\s+:\s+(POWER\d+)", line, re.IGNORECASE)
if res:
break
family = res[0].decode("utf-8").lower()
Expand Down

0 comments on commit 5441d6d

Please sign in to comment.