aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCleber Rosa <crosa@redhat.com>2021-02-03 12:23:43 -0500
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2021-02-08 17:22:36 +0100
commitc0d1681e501180065927f40f4bfd0ed2a06d2ff1 (patch)
tree75f770098be0e9456b6c2855a2cceef28641d535
parent14a79778e17bb7e087101b00d6b1839dc7858f1e (diff)
downloadqemu-arm-c0d1681e501180065927f40f4bfd0ed2a06d2ff1.tar.gz
tests/acceptance/virtiofs_submounts: standardize port as integer
Instead of having to cast it whenever it's going to be used, let's standardize it as an integer, which is the data type that will be used most often. Given that the regex will only match digits, it's safe that we'll end up getting a integer, but, it could as well be a zero. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Beraldo Leal <bleal@redhat.com> Message-Id: <20210203172357.1422425-9-crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
-rw-r--r--tests/acceptance/virtiofs_submounts.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py
index f1b49f03bb..8294175608 100644
--- a/tests/acceptance/virtiofs_submounts.py
+++ b/tests/acceptance/virtiofs_submounts.py
@@ -86,17 +86,18 @@ class VirtiofsSubmountsTest(BootLinux):
re.search(r'TCP.HOST_FORWARD.*127\.0\.0\.1\s*(\d+)\s+10\.',
line)
if match is not None:
- port = match[1]
+ port = int(match[1])
break
self.assertIsNotNone(port)
- self.log.debug('sshd listening on port: ' + port)
+ self.assertGreater(port, 0)
+ self.log.debug('sshd listening on port: %d', port)
return port
def ssh_connect(self, username, keyfile):
self.ssh_logger = logging.getLogger('ssh')
port = self.get_portfwd()
- self.ssh_session = ssh.Session('127.0.0.1', port=int(port),
+ self.ssh_session = ssh.Session('127.0.0.1', port=port,
user=username, key=keyfile)
for i in range(10):
try: