[pypy-svn] r71666 - pypy/branch/jit-sandbox/pypy/translator/sandbox/test

fijal at codespeak.net fijal at codespeak.net
Tue Mar 2 21:12:52 CET 2010


Author: fijal
Date: Tue Mar  2 21:12:47 2010
New Revision: 71666

Modified:
   pypy/branch/jit-sandbox/pypy/translator/sandbox/test/test_sandbox.py
Log:
A failing test (finally!)


Modified: pypy/branch/jit-sandbox/pypy/translator/sandbox/test/test_sandbox.py
==============================================================================
--- pypy/branch/jit-sandbox/pypy/translator/sandbox/test/test_sandbox.py	(original)
+++ pypy/branch/jit-sandbox/pypy/translator/sandbox/test/test_sandbox.py	Tue Mar  2 21:12:47 2010
@@ -1,6 +1,7 @@
 import py
 import sys, os, time
 import struct
+import subprocess
 
 from pypy.rpython.lltypesystem import rffi
 from pypy.translator.interactive import Translation
@@ -19,8 +20,8 @@
         write_message(g, result, resulttype)
         g.flush()
 
-def compile(f):
-    t = Translation(f, backend='c', standalone=True, sandbox=True, gc='ref')
+def compile(f, gc='ref'):
+    t = Translation(f, backend='c', standalone=True, sandbox=True, gc=gc)
     return str(t.compile())
 
 
@@ -131,6 +132,24 @@
     f.close()
     assert tail == ""
 
+def test_hybrid_gc():
+    def entry_point(argv):
+        return int(len("x" * int(argv[0])) < 350)
+
+    exe = compile(entry_point, gc='hybrid')
+    pipe = subprocess.Popen([exe, '1000000'], stdout=subprocess.PIPE,
+                            stdin=subprocess.PIPE)
+    g = pipe.stdin
+    f = pipe.stdout
+    expect(f, g, "ll_os.ll_os_getenv", ("PYPY_GENERATIONGC_NURSERY",), None)
+    expect(f, g, "ll_os.ll_os_open", ("/proc/cpuinfo", 0, 420), OSError(5232, "xyz"))
+    g.close()
+    tail = f.read()
+    f.close()
+    assert tail == ""
+    rescode = pipe.wait()
+    assert rescode == 0
+
 class TestPrintedResults:
 
     def run(self, entry_point, args, expected):



More information about the Pypy-commit mailing list