about summary refs log tree commit diff stats
path: root/test/arch/x86/qemu/testqemu64.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/arch/x86/qemu/testqemu64.py')
-rw-r--r--test/arch/x86/qemu/testqemu64.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/arch/x86/qemu/testqemu64.py b/test/arch/x86/qemu/testqemu64.py
index 24193d40..636cb6a9 100644
--- a/test/arch/x86/qemu/testqemu64.py
+++ b/test/arch/x86/qemu/testqemu64.py
@@ -16,24 +16,24 @@ from miasm.jitter.csts import PAGE_READ, PAGE_WRITE
 
 # Utils
 def parse_fmt(s):
-    fmt = s[:]+b"\x00"
+    fmt = s[:]+"\x00"
     out = []
     i = 0
     while i < len(fmt):
         c = fmt[i:i+1]
-        if c != b"%":
+        if c != "%":
             i+=1
             continue
-        if fmt[i+1:i+2] == b"%":
+        if fmt[i+1:i+2] == "%":
             i+=2
             continue
         j = 0
         i+=1
-        while fmt[i+j:i+j+1] in b"0123456789$.-":
+        while fmt[i+j:i+j+1] in "0123456789$.-":
             j+=1
-        if fmt[i+j:i+j+1] in [b'l']:
+        if fmt[i+j:i+j+1] in ['l']:
             j +=1
-        if fmt[i+j:i+j+1] == b"h":
+        if fmt[i+j:i+j+1] == "h":
             x = fmt[i+j:i+j+2]
         else:
             x = fmt[i+j:i+j+1]
@@ -50,8 +50,8 @@ def xxx___printf_chk(jitter):
         raise RuntimeError("Not implemented")
     fmt = jitter.get_str_ansi(args.format)
     # Manage llx
-    fmt = fmt.replace(b"llx", b"lx")
-    fmt = fmt.replace(b"%016lx", b"%016z")
+    fmt = fmt.replace("llx", "lx")
+    fmt = fmt.replace("%016lx", "%016z")
 
     fmt_a = parse_fmt(fmt)
     args = []
@@ -59,11 +59,11 @@ def xxx___printf_chk(jitter):
 
     for x in fmt_a:
         a = jitter.get_arg_n_systemv(2 + i)
-        if x == b"s":
+        if x == "s":
             a = jitter.get_str_ansi(a)
-        elif x in (b"x", b'X', b'd', b'z', b'Z'):
+        elif x in ("x", 'X', 'd', 'z', 'Z'):
             pass
-        elif x.lower() in (b"f","l"):
+        elif x.lower() in ("f","l"):
             a = struct.unpack("d", struct.pack("Q", a))[0]
             i += 1
         else:
@@ -71,22 +71,22 @@ def xxx___printf_chk(jitter):
         args.append(a)
         i += 1
 
-    fmt = fmt.replace(b"%016z", b"%016lx")
+    fmt = fmt.replace("%016z", "%016lx")
     output = fmt%(tuple(args))
     # NaN bad repr in Python
-    output = output.replace(b"nan", b"-nan")
+    output = output.replace("nan", "-nan")
 
-    if b"\n" not in output:
+    if "\n" not in output:
         raise RuntimeError("Format must end with a \\n")
 
     # Check with expected result
     line = next(expected)
-    if output != line.encode():
+    if output != line:
         print("Expected:", line)
         print("Obtained:", output)
         raise RuntimeError("Bad semantic")
 
-    stdout.write(b"[%d] %s" % (nb_tests, output))
+    stdout.write(b"[%d] %s" % (nb_tests, output.encode('utf8')))
     nb_tests += 1
     jitter.func_ret_systemv(ret_ad, 0)