[libvirt PATCH 02/29] cpu-gather: Create python wrapper for shell script

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

 



This changes the invocation from
  ./cpu-gather.sh | ./cpu-parse.sh
to
  ./cpu-gather.py | ./cpu-parse.sh

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

diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py
new file mode 100755
index 0000000000..f7030eb48b
--- /dev/null
+++ b/tests/cputestdata/cpu-gather.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+
+def main():
+    os.environ["CPU_GATHER_PY"] = "true"
+    subprocess.check_call("./cpu-gather.sh")
+
+
+if __name__ == "__main__":
+    main()
diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh
index 7574324d1c..cd65d74da5 100755
--- a/tests/cputestdata/cpu-gather.sh
+++ b/tests/cputestdata/cpu-gather.sh
@@ -4,6 +4,11 @@
 # distro does not provide such package, you can find the sources or binary
 # packages at https://www.etallen.com/cpuid.html
 
+if [ -z "${CPU_GATHER_PY}" ]; then
+    echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instead."
+    exit 1
+fi
+
 grep 'model name' /proc/cpuinfo | head -n1
 
 cpuid -1r
-- 
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