diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-14 11:34:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-16 11:46:07 +0000 |
commit | f1d0b6d296cd9dadd6a0edd40d87b71fcf87949d (patch) | |
tree | 2f6d2b2bc44f6b7e3f5e83e98e407dd5da5a55bf | |
parent | 3e9505274bfc96a3d10003c0ebd5d4918d734487 (diff) | |
download | poky-f1d0b6d296cd9dadd6a0edd40d87b71fcf87949d.tar.gz |
oeqa/utils/qemurunner.py: Fix python regex warnings
Fix the warnings:
meta/lib/oeqa/utils/qemurunner.py:250: DeprecationWarning: invalid escape sequence \.
ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
meta/lib/oeqa/utils/qemurunner.py:343: DeprecationWarning: invalid escape sequence \-
if re.search("root@[a-zA-Z0-9\-]+:~#", output):
poky/meta/lib/oeqa/utils/qemurunner.py:350: DeprecationWarning: invalid escape sequence \-
if re.search("root@[a-zA-Z0-9\-]+:~#", output):
meta/lib/oeqa/utils/qemurunner.py:448: DeprecationWarning: invalid escape sequence \-
if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
by correctly marking the regexs.
(From OE-Core rev: 8e6987735002560fca714f77ea8ece9d4b28f7fa)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index dfab1bd5f1..d40b3b808b 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
@@ -238,13 +238,13 @@ class QemuRunner: | |||
238 | # because is possible to have control characters | 238 | # because is possible to have control characters |
239 | cmdline = re_control_char.sub(' ', cmdline) | 239 | cmdline = re_control_char.sub(' ', cmdline) |
240 | try: | 240 | try: |
241 | ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) | 241 | ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1]) |
242 | self.ip = ips[0] | 242 | self.ip = ips[0] |
243 | self.server_ip = ips[1] | 243 | self.server_ip = ips[1] |
244 | self.logger.debug("qemu cmdline used:\n{}".format(cmdline)) | 244 | self.logger.debug("qemu cmdline used:\n{}".format(cmdline)) |
245 | except (IndexError, ValueError): | 245 | except (IndexError, ValueError): |
246 | # Try to get network configuration from runqemu output | 246 | # Try to get network configuration from runqemu output |
247 | match = re.match('.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*', | 247 | match = re.match(r'.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*', |
248 | out, re.MULTILINE|re.DOTALL) | 248 | out, re.MULTILINE|re.DOTALL) |
249 | if match: | 249 | if match: |
250 | self.ip, self.server_ip, self.netmask = match.groups() | 250 | self.ip, self.server_ip, self.netmask = match.groups() |
@@ -331,14 +331,14 @@ class QemuRunner: | |||
331 | # If we are not able to login the tests can continue | 331 | # If we are not able to login the tests can continue |
332 | try: | 332 | try: |
333 | (status, output) = self.run_serial("root\n", raw=True) | 333 | (status, output) = self.run_serial("root\n", raw=True) |
334 | if re.search("root@[a-zA-Z0-9\-]+:~#", output): | 334 | if re.search(r"root@[a-zA-Z0-9\-]+:~#", output): |
335 | self.logged = True | 335 | self.logged = True |
336 | self.logger.debug("Logged as root in serial console") | 336 | self.logger.debug("Logged as root in serial console") |
337 | if netconf: | 337 | if netconf: |
338 | # configure guest networking | 338 | # configure guest networking |
339 | cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask) | 339 | cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask) |
340 | output = self.run_serial(cmd, raw=True)[1] | 340 | output = self.run_serial(cmd, raw=True)[1] |
341 | if re.search("root@[a-zA-Z0-9\-]+:~#", output): | 341 | if re.search(r"root@[a-zA-Z0-9\-]+:~#", output): |
342 | self.logger.debug("configured ip address %s", self.ip) | 342 | self.logger.debug("configured ip address %s", self.ip) |
343 | else: | 343 | else: |
344 | self.logger.debug("Couldn't configure guest networking") | 344 | self.logger.debug("Couldn't configure guest networking") |
@@ -436,7 +436,7 @@ class QemuRunner: | |||
436 | if answer: | 436 | if answer: |
437 | data += answer.decode('utf-8') | 437 | data += answer.decode('utf-8') |
438 | # Search the prompt to stop | 438 | # Search the prompt to stop |
439 | if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data): | 439 | if re.search(r"[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data): |
440 | break | 440 | break |
441 | else: | 441 | else: |
442 | raise Exception("No data on serial console socket") | 442 | raise Exception("No data on serial console socket") |