Fix VPCS tests for recent version

This commit is contained in:
Julien Duponchelle committed 2017-04-13 15:56:12 +02:00
1 parent 6d150bb62c
commit 85136bc2e4
3 files changed
+19 -28

No files matched your search

+1 -1
View File
@@ -202,7 +202,7 @@ class VPCSHandler:
nio_type = request.json["type"]
if nio_type not in ("nio_udp", "nio_tap"):
raise HTTPConflict(text="NIO of type {} is not supported".format(nio_type))
nio = vpcs_manager.create_nio(vm.vpcs_path, request.json)
nio = vpcs_manager.create_nio(vm.vpcs_path(), request.json)
vm.port_add_nio_binding(int(request.match_info["port_number"]), nio)
response.set_status(201)
response.json(nio)
+6 -7
View File
@@ -94,7 +94,7 @@ class VPCSVM(BaseVM):
Check if VPCS is available with the correct version.
"""
path = self.vpcs_path
path = self.vpcs_path()
if not path:
raise VPCSError("No path to a VPCS executable has been set")
@@ -132,7 +132,6 @@ class VPCSVM(BaseVM):
else:
return None
@property
def vpcs_path(self):
"""
Returns the VPCS executable path.
@@ -203,7 +202,7 @@ class VPCSVM(BaseVM):
Checks if the VPCS executable version is >= 0.8b or == 0.6.1.
"""
try:
output = yield from subprocess_check_output(self.vpcs_path, "-v", cwd=self.working_dir)
output = yield from subprocess_check_output(self.vpcs_path(), "-v", cwd=self.working_dir)
match = re.search("Welcome to Virtual PC Simulator, version ([0-9a-z\.]+)", output)
if match:
version = match.group(1)
@@ -211,7 +210,7 @@ class VPCSVM(BaseVM):
if self._vpcs_version < parse_version("0.8b") and self._vpcs_version != parse_version("0.6.1"):
raise VPCSError("VPCS executable version must be >= 0.8b or 0.6.1")
else:
raise VPCSError("Could not determine the VPCS version for {}".format(self.vpcs_path))
raise VPCSError("Could not determine the VPCS version for {}".format(self.vpcs_path()))
except (OSError, subprocess.SubprocessError) as e:
raise VPCSError("Error while looking for the VPCS version: {}".format(e))
@@ -247,8 +246,8 @@ class VPCSVM(BaseVM):
self.status = "started"
except (OSError, subprocess.SubprocessError) as e:
vpcs_stdout = self.read_vpcs_stdout()
log.error("Could not start VPCS {}: {}\n{}".format(self.vpcs_path, e, vpcs_stdout))
raise VPCSError("Could not start VPCS {}: {}\n{}".format(self.vpcs_path, e, vpcs_stdout))
log.error("Could not start VPCS {}: {}\n{}".format(self.vpcs_path(), e, vpcs_stdout))
raise VPCSError("Could not start VPCS {}: {}\n{}".format(self.vpcs_path(), e, vpcs_stdout))
def _termination_callback(self, returncode):
"""
@@ -417,7 +416,7 @@ class VPCSVM(BaseVM):
"""
command = [self.vpcs_path]
command = [self.vpcs_path()]
command.extend(["-p", str(self._console)]) # listen to console port
command.extend(["-m", str(self._manager.get_mac_id(self.id))]) # the unique ID is used to set the MAC address offset
command.extend(["-i", "1"]) # option to start only one VPC instance