about summary refs log tree commit diff stats
path: root/test/arch/x86/qemu/testqemu.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/arch/x86/qemu/testqemu.py')
-rw-r--r--test/arch/x86/qemu/testqemu.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/arch/x86/qemu/testqemu.py b/test/arch/x86/qemu/testqemu.py
index d04308e4..7cf2ab75 100644
--- a/test/arch/x86/qemu/testqemu.py
+++ b/test/arch/x86/qemu/testqemu.py
@@ -84,6 +84,22 @@ def xxx___printf_chk(jitter):
     nb_tests += 1
     jitter.func_ret_cdecl(ret_ad, 0)
 
+def xxx_puts(jitter):
+    '''
+    #include <stdio.h>
+    int puts(const char *s);
+
+    writes the string s and a trailing newline to stdout.
+    '''
+    ret_addr, args = jitter.func_args_cdecl(['target'])
+    output = jitter.get_str_ansi(args.target)
+    # Check with expected result
+    line = expected.next()
+    if output != line.rstrip():
+        print "Expected:", line
+        print "Obtained:", output
+        raise RuntimeError("Bad semantic")
+    return jitter.func_ret_cdecl(ret_addr, 1)
 
 # Parse arguments
 parser = Sandbox_Linux_x86_32.parser(description="ELF sandboxer")