[libvirt PATCH 03/29] cpu-gather: Move model_name to new script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 tests/cputestdata/cpu-gather.py | 13 +++++++++++++
 tests/cputestdata/cpu-gather.sh |  2 --
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py
index f7030eb48b..1b02df6ec7 100755
--- a/tests/cputestdata/cpu-gather.py
+++ b/tests/cputestdata/cpu-gather.py
@@ -4,7 +4,20 @@ import os
 import subprocess
 
 
+def gather_name():
+    with open("/proc/cpuinfo", "rt") as f:
+        for line in f.readlines():
+            if line.startswith("model name"):
+                return line.split(":", 2)[1].strip()
+
+    exit("Error: '/proc/cpuinfo' does not contain a model name.")
+
+
 def main():
+    name = gather_name()
+    print("model name\t: {}".format(name))
+
+    print(end="", flush=True)
     os.environ["CPU_GATHER_PY"] = "true"
     subprocess.check_call("./cpu-gather.sh")
 
diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh
index cd65d74da5..b671f223a5 100755
--- a/tests/cputestdata/cpu-gather.sh
+++ b/tests/cputestdata/cpu-gather.sh
@@ -9,8 +9,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
     exit 1
 fi
 
-grep 'model name' /proc/cpuinfo | head -n1
-
 cpuid -1r
 echo
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux