mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
parent
ba4128f57b
commit
8225bad76b
@ -157,6 +157,10 @@ class QemuVM(BaseVM):
|
||||
else:
|
||||
qemu_bin = os.path.basename(qemu_path)
|
||||
qemu_bin = re.sub(r'(w)?\.(exe|EXE)$', '', qemu_bin)
|
||||
# Old version of GNS3 provide a binary named qemu.exe
|
||||
if qemu_bin == "qemu":
|
||||
self._platform = "i386"
|
||||
else:
|
||||
self._platform = re.sub(r'^qemu-system-(.*)$', r'\1', qemu_bin, re.IGNORECASE)
|
||||
if self._platform.split(".")[0] not in QEMU_PLATFORMS:
|
||||
raise QemuError("Platform {} is unknown".format(self._platform))
|
||||
|
@ -258,6 +258,19 @@ def test_set_qemu_path_windows(vm, tmpdir):
|
||||
assert vm.platform == "x86_64"
|
||||
|
||||
|
||||
def test_set_qemu_path_old_windows(vm, tmpdir):
|
||||
|
||||
bin_path = os.path.join(os.environ["PATH"], "qemu.exe")
|
||||
open(bin_path, "w+").close()
|
||||
os.chmod(bin_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
|
||||
vm.qemu_path = bin_path
|
||||
|
||||
assert vm.qemu_path == bin_path
|
||||
assert vm.platform == "i386"
|
||||
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||
def test_set_qemu_path_kvm_binary(vm, tmpdir, fake_qemu_binary):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user