summary refs log tree commit diff stats
path: root/tests/vm/basevm.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-10-16 08:22:56 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-10-17 15:20:53 +0200
commit86a8989d4557a09b68f8b78b6c3fb6ad3f23ca6f (patch)
treee9d04dd3673999826af30cc489bfc475be1703dd /tests/vm/basevm.py
parent1b5f3f65cc71341a4f9fc9e89bb6985fde703758 (diff)
downloadfocaccia-qemu-86a8989d4557a09b68f8b78b6c3fb6ad3f23ca6f.tar.gz
focaccia-qemu-86a8989d4557a09b68f8b78b6c3fb6ad3f23ca6f.zip
tests/vm: avoid invalid escape in Python string
This is an error in Python 3.12; fix it by using a raw string literal
or by double-escaping the backslash.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r--tests/vm/basevm.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 8aef4cff96..61725b8325 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -331,8 +331,8 @@ class BaseVM(object):
     def console_log(self, text):
         for line in re.split("[\r\n]", text):
             # filter out terminal escape sequences
-            line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line)
-            line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line)
+            line = re.sub("\x1b\\[[0-9;?]*[a-zA-Z]", "", line)
+            line = re.sub("\x1b\\([0-9;?]*[a-zA-Z]", "", line)
             # replace unprintable chars
             line = re.sub("\x1b", "<esc>", line)
             line = re.sub("[\x00-\x1f]", ".", line)
@@ -530,7 +530,7 @@ def get_qemu_version(qemu_path):
        and return the major number."""
     output = subprocess.check_output([qemu_path, '--version'])
     version_line = output.decode("utf-8")
-    version_num = re.split(' |\(', version_line)[3].split('.')[0]
+    version_num = re.split(r' |\(', version_line)[3].split('.')[0]
     return int(version_num)
 
 def parse_config(config, args):