From 84a5a3553e12c235083cb71dd59b62213df0874c Mon Sep 17 00:00:00 2001 From: Disha Goel Date: Tue, 29 Aug 2023 18:00:36 +0530 Subject: [PATCH] add function to get revision value added a new function to get revision value from /proc/cpuinfo file e.g. '0080' for Power10 Signed-off-by: Disha Goel --- avocado/utils/cpu.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/avocado/utils/cpu.py b/avocado/utils/cpu.py index 700dce6604..3980a15117 100644 --- a/avocado/utils/cpu.py +++ b/avocado/utils/cpu.py @@ -163,6 +163,22 @@ def get_vendor(): return None +def get_revision(): + """ + Get revision from /proc/cpuinfo + + :return: revision entry from /proc/cpuinfo file + e.g.:- '0080' for IBM POWER10 machine + :rtype: str + """ + rev = None + proc_cpuinfo = genio.read_file("/proc/cpuinfo") + for line in proc_cpuinfo.splitlines(): + if "revision" in line: + rev = line.split(" ")[3].strip() + return rev + + def get_arch(): """Work out which CPU architecture we're running on.""" cpu_table = [