From: Tim Wiederhake Date: Tue, 15 Dec 2020 16:24:54 +0000 (+0100) Subject: cpu-gather: Move qemu detection to new script X-Git-Tag: v7.0.0-rc1~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=028fc10cb3ef8c64997edd19805e8c19e4f81296;p=thirdparty%2Flibvirt.git cpu-gather: Move qemu detection to new script Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- 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]'