mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
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)
(From OE-Core rev: a980cb8a0940d4db4bb5d338650cf848cd292f5b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -238,13 +238,13 @@ class QemuRunner:
|
|||||||
# because is possible to have control characters
|
# because is possible to have control characters
|
||||||
cmdline = re_control_char.sub(' ', cmdline)
|
cmdline = re_control_char.sub(' ', cmdline)
|
||||||
try:
|
try:
|
||||||
ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
|
ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
|
||||||
self.ip = ips[0]
|
self.ip = ips[0]
|
||||||
self.server_ip = ips[1]
|
self.server_ip = ips[1]
|
||||||
self.logger.debug("qemu cmdline used:\n{}".format(cmdline))
|
self.logger.debug("qemu cmdline used:\n{}".format(cmdline))
|
||||||
except (IndexError, ValueError):
|
except (IndexError, ValueError):
|
||||||
# Try to get network configuration from runqemu output
|
# Try to get network configuration from runqemu output
|
||||||
match = re.match('.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*',
|
match = re.match(r'.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*',
|
||||||
out, re.MULTILINE|re.DOTALL)
|
out, re.MULTILINE|re.DOTALL)
|
||||||
if match:
|
if match:
|
||||||
self.ip, self.server_ip, self.netmask = match.groups()
|
self.ip, self.server_ip, self.netmask = match.groups()
|
||||||
@@ -331,14 +331,14 @@ class QemuRunner:
|
|||||||
# If we are not able to login the tests can continue
|
# If we are not able to login the tests can continue
|
||||||
try:
|
try:
|
||||||
(status, output) = self.run_serial("root\n", raw=True)
|
(status, output) = self.run_serial("root\n", raw=True)
|
||||||
if re.search("root@[a-zA-Z0-9\-]+:~#", output):
|
if re.search(r"root@[a-zA-Z0-9\-]+:~#", output):
|
||||||
self.logged = True
|
self.logged = True
|
||||||
self.logger.debug("Logged as root in serial console")
|
self.logger.debug("Logged as root in serial console")
|
||||||
if netconf:
|
if netconf:
|
||||||
# configure guest networking
|
# configure guest networking
|
||||||
cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask)
|
cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask)
|
||||||
output = self.run_serial(cmd, raw=True)[1]
|
output = self.run_serial(cmd, raw=True)[1]
|
||||||
if re.search("root@[a-zA-Z0-9\-]+:~#", output):
|
if re.search(r"root@[a-zA-Z0-9\-]+:~#", output):
|
||||||
self.logger.debug("configured ip address %s", self.ip)
|
self.logger.debug("configured ip address %s", self.ip)
|
||||||
else:
|
else:
|
||||||
self.logger.debug("Couldn't configure guest networking")
|
self.logger.debug("Couldn't configure guest networking")
|
||||||
@@ -444,7 +444,7 @@ class QemuRunner:
|
|||||||
if answer:
|
if answer:
|
||||||
data += answer.decode('utf-8')
|
data += answer.decode('utf-8')
|
||||||
# Search the prompt to stop
|
# Search the prompt to stop
|
||||||
if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
|
if re.search(r"[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise Exception("No data on serial console socket")
|
raise Exception("No data on serial console socket")
|
||||||
|
|||||||
Reference in New Issue
Block a user