[libvirt PATCH 08/29] cpu-gather: Move qemu detection 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 | 17 +++++++++++++++++
 tests/cputestdata/cpu-gather.sh |  8 --------
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py
index db2348b460..7f9479f78d 100755
--- a/tests/cputestdata/cpu-gather.py
+++ b/tests/cputestdata/cpu-gather.py
@@ -77,9 +77,25 @@ def main():
         metavar="PATH",
         help="Path to 'cpuid' utility. "
         "If unset, the first executable 'cpuid' in $PATH is used.")
+    parser.add_argument(
+        "--path-to-qemu",
+        metavar="PATH",
+        help="Path to qemu. "
+        "If unset, will try '/usr/bin/qemu-system-x86_64', "
+        "'/usr/bin/qemu-kvm', and '/usr/libexec/qemu-kvm'.")
 
     args = parser.parse_args()
 
+    if not args.path_to_qemu:
+        args.path_to_qemu = "qemu-system-x86_64"
+        search = [
+            "/usr/bin/qemu-system-x86_64",
+            "/usr/bin/qemu-kvm",
+            "/usr/libexec/qemu-kvm"]
+        for f in search:
+            if os.path.isfile(f):
+                args.path_to_qemu = f
+
     name = gather_name(args)
     print("model name\t: {}".format(name))
 
@@ -97,6 +113,7 @@ def main():
 
     print(end="", flush=True)
     os.environ["CPU_GATHER_PY"] = "true"
+    os.environ["qemu"] = args.path_to_qemu
     subprocess.check_call("./cpu-gather.sh")
 
 
diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh
index 427b81a64b..4b4ac1a47c 100755
--- a/tests/cputestdata/cpu-gather.sh
+++ b/tests/cputestdata/cpu-gather.sh
@@ -5,14 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then
     exit 1
 fi
 
-qemu=qemu-system-x86_64
-for cmd in /usr/bin/$qemu /usr/bin/qemu-kvm /usr/libexec/qemu-kvm; do
-    if [[ -x $cmd ]]; then
-        qemu=$cmd
-        break
-    fi
-done
-
 qom_get()
 {
     path='/machine/unattached/device[0]'
-- 
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