Add qemu-kvm to the list of binary

This commit is contained in:
Julien Duponchelle 2015-04-20 10:12:17 +02:00
parent 3926390d30
commit 531e95463c
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,7 @@ class Qemu(BaseManager):
for path in paths: for path in paths:
try: try:
for f in os.listdir(path): for f in os.listdir(path):
if (f.startswith("qemu-system") or f == "qemu" or f == "qemu.exe") and \ if (f.startswith("qemu-system") or f.startswith("qemu-kvm") or f == "qemu" or f == "qemu.exe") and \
os.access(os.path.join(path, f), os.X_OK) and \ os.access(os.path.join(path, f), os.X_OK) and \
os.path.isfile(os.path.join(path, f)): os.path.isfile(os.path.join(path, f)):
qemu_path = os.path.join(path, f) qemu_path = os.path.join(path, f)

View File

@ -32,7 +32,7 @@ def test_get_qemu_version(loop):
def test_binary_list(loop): def test_binary_list(loop):
files_to_create = ["qemu-system-x86", "qemu-system-x42", "hello"] files_to_create = ["qemu-system-x86", "qemu-system-x42", "qemu-kvm", "hello"]
for file_to_create in files_to_create: for file_to_create in files_to_create:
path = os.path.join(os.environ["PATH"], file_to_create) path = os.path.join(os.environ["PATH"], file_to_create)
@ -44,6 +44,7 @@ def test_binary_list(loop):
qemus = loop.run_until_complete(asyncio.async(Qemu.binary_list())) qemus = loop.run_until_complete(asyncio.async(Qemu.binary_list()))
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": "2.2.0"} in qemus assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": "2.2.0"} in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": "2.2.0"} in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": "2.2.0"} in qemus assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": "2.2.0"} in qemus
assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": "2.2.0"} not in qemus assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": "2.2.0"} not in qemus