diff --git a/src/python/devtest/os/Machine.py b/src/python/devtest/os/Machine.py index a5cb5a0..b5fb2cf 100644 --- a/src/python/devtest/os/Machine.py +++ b/src/python/devtest/os/Machine.py @@ -70,7 +70,7 @@ class Machine(ABC): # export @property def exe_basename(self): - return re.sub('\.py$', '', os.path.basename(self.exe_path)) + return re.sub(r'\.py$', '', os.path.basename(self.exe_path)) @property def tmpdir(self): diff --git a/src/python/devtest/os/be/qemu/Machine.py b/src/python/devtest/os/be/qemu/Machine.py index e57b0fa..727ec74 100644 --- a/src/python/devtest/os/be/qemu/Machine.py +++ b/src/python/devtest/os/be/qemu/Machine.py @@ -17,7 +17,7 @@ from ...Connection import Connection from ...conn.Fifos import Fifos as ConnFifos from . import Invocation -_ifupdown_script="""#!/bin/bash +_ifupdown_script=r"""#!/bin/bash #echo exit for test purposes; exit 1 goodbye() @@ -220,7 +220,7 @@ class Machine(MachineBase): # export self.__task = None async def __await_monitor_prompt(self, act_timeout=2.): - if await expect(self.monitor, regex='\(qemu\) ', subject="Qemu monitor prompt", + if await expect(self.monitor, regex=r'\(qemu\) ', subject="Qemu monitor prompt", act_timeout=act_timeout) is None: raise Exception("timed out waiting for Qemu monitor prompt") @@ -306,7 +306,7 @@ class Machine(MachineBase): # export return self.__invocation def net_helper_path(self, up): - if re.search('ifup\|ifdown', self.exe_basename): + if re.search(r'ifup\|ifdown', self.exe_basename): return None if not self.__net_helper: slog_m(INFO, "config = >%s<" % self.invocation.helper_config) diff --git a/src/python/devtest/os/test/cases/Audit.py b/src/python/devtest/os/test/cases/Audit.py index b0c1a7a..c36d871 100644 --- a/src/python/devtest/os/test/cases/Audit.py +++ b/src/python/devtest/os/test/cases/Audit.py @@ -78,7 +78,7 @@ class Audit(ListCmd): # export self.__multi_regex = [ ('match', r'type=SYSCALL'), ('sub', r'0x[0-9a-f]+', '0x'), - ('sub', 'type=SYSCALL msg=audit\([^)+]\) *:', '') + ('sub', r'type=SYSCALL msg=audit\([^)+]\) *:', '') ] super().__init__(*args, **kwargs) diff --git a/src/python/devtest/os/test/cases/CheckMounts.py b/src/python/devtest/os/test/cases/CheckMounts.py index 7ed2ed0..24a8413 100644 --- a/src/python/devtest/os/test/cases/CheckMounts.py +++ b/src/python/devtest/os/test/cases/CheckMounts.py @@ -7,6 +7,6 @@ class CheckMounts(GrepLog): # export def __init__(self, mounts, act_timeout=2, total_timeout=None): regexes = [] for mount in mounts: - regexes.append('^{} \+{} \+'.format(*mount)) + regexes.append(r'^{} \+{} \+'.format(*mount)) super().__init__(regex=regexes, log_glob='/proc/mounts', act_timeout=act_timeout, total_timeout=total_timeout) diff --git a/src/python/devtest/os/test/cases/ConfigUpdater.py b/src/python/devtest/os/test/cases/ConfigUpdater.py index 89cfdd6..ee5bea2 100644 --- a/src/python/devtest/os/test/cases/ConfigUpdater.py +++ b/src/python/devtest/os/test/cases/ConfigUpdater.py @@ -6,5 +6,5 @@ class ConfigUpdater(GrepLog): # export def __init__(self, regex = None, log_glob=None, act_timeout=2, total_timeout=None): if regex is None: - regex = 'Configuration updated (version=.*)\|Configuration (version=.*) is up-to-date (target-version=.*)' + regex = r'Configuration updated (version=.*)\|Configuration (version=.*) is up-to-date (target-version=.*)' super().__init__(regex=regex, log_glob=log_glob, act_timeout=act_timeout, total_timeout=total_timeout) diff --git a/src/python/devtest/os/test/cases/LsofNet.py b/src/python/devtest/os/test/cases/LsofNet.py index 1a2b326..df23ca5 100644 --- a/src/python/devtest/os/test/cases/LsofNet.py +++ b/src/python/devtest/os/test/cases/LsofNet.py @@ -11,7 +11,7 @@ class LsofNet(ListCmd): # export # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME # systemd 1 root 42u IPv4 9763 0t0 TCP * : 222 (LISTEN) # confd.smp 1190 root 77u IPv4 27916 0t0 TCP *:ssh (LISTEN) - "^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +([0-9]+) +(\S+) +(UDP|TCP) +([^: ])+:([0-9a-z]+) +(\(LISTEN\))", + r"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +([0-9]+) +(\S+) +(UDP|TCP) +([^: ])+:([0-9a-z]+) +(\(LISTEN\))", [ 'cmd', 'pid', 'user','fd', 'type', 'device','size/off','prot', 'addr', 'port', 'attrib' ], [ 'cmd', 'user', 'prot', 'addr', 'port' ], [ 'prot', 'port' ] diff --git a/src/python/devtest/os/test/cases/LsofUds.py b/src/python/devtest/os/test/cases/LsofUds.py index 3ae63cd..e893407 100644 --- a/src/python/devtest/os/test/cases/LsofUds.py +++ b/src/python/devtest/os/test/cases/LsofUds.py @@ -9,7 +9,7 @@ class LsofUds(ListCmd): # export r'lsof +c 15 -U', # COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME # systemd 1 root 45u unix 0xeeb45200 0t0 9856 /run/systemd/journal/stdout type=STREAM - "^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +(0x[0-9a-f]+) +(\S+) +([0-9]+) +(\S+) +type=(\S+)", + r"^ *(\S+) +([0-9]+) +(\S+) +(\S+) +(\S+) +(0x[0-9a-f]+) +(\S+) +([0-9]+) +(\S+) +type=(\S+)", [ 'cmd', 'pid', 'user','fd', 'type', 'device', 'size/off','node', 'path', 'socktype' ], [ 'cmd', 'user', 'path', 'socktype' ], [ 'cmd', 'path' ], diff --git a/src/python/devtest/os/test/cases/ProcMounts.py b/src/python/devtest/os/test/cases/ProcMounts.py index d8cebd6..33db22e 100644 --- a/src/python/devtest/os/test/cases/ProcMounts.py +++ b/src/python/devtest/os/test/cases/ProcMounts.py @@ -10,7 +10,7 @@ class MountList(ListCmd): # export #r"/bin/cat /proc/mounts | sed 's/,*size=[0-9]\+[a-z]*//g; s/,*nr_inodes=[0-9]\+//g; s/,,*/,/g'", r"/bin/cat /proc/mounts", # proc /proc proc rw,relatime 0 0 - "^ *([a-zA-Z0-9/:]+) (/[a-zA-Z0-9/]+) +(\S+) +(\S+) +([0-9]+) +([0-9]+)", + r"^ *([a-zA-Z0-9/:]+) (/[a-zA-Z0-9/]+) +(\S+) +(\S+) +([0-9]+) +([0-9]+)", [ 'dev', 'mp', 'type','opts','dump', 'fsck'], [ 'dev', 'mp', 'type','opts' ], [ 'mp', ]