[pypy-commit] pypy kill-someobject: make boehm tests run

alex_gaynor noreply at buildbot.pypy.org
Mon Oct 8 14:03:20 CEST 2012


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-someobject
Changeset: r57905:2e1f0a72b224
Date: 2012-10-08 14:02 +0200
http://bitbucket.org/pypy/pypy/changeset/2e1f0a72b224/

Log:	make boehm tests run

diff --git a/pypy/translator/c/test/test_boehm.py b/pypy/translator/c/test/test_boehm.py
--- a/pypy/translator/c/test/test_boehm.py
+++ b/pypy/translator/c/test/test_boehm.py
@@ -2,14 +2,13 @@
 
 import py
 
-from pypy import conftest
 from pypy.rlib import rgc
 from pypy.rlib.objectmodel import (keepalive_until_here, compute_unique_id,
     compute_hash, current_object_addr_as_int)
 from pypy.rpython.lltypesystem import lltype, llmemory
 from pypy.rpython.lltypesystem.lloperation import llop
 from pypy.rpython.lltypesystem.rstr import STR
-from pypy.translator.translator import TranslationContext
+from pypy.translator.c.test.test_genc import compile
 
 
 def setup_module(mod):
@@ -35,27 +34,7 @@
             self._cleanups.pop()()
 
     def getcompiled(self, func, argstypelist=[], annotatorpolicy=None):
-        from pypy.config.pypyoption import get_pypy_config
-        config = get_pypy_config(translating=True)
-        config.translation.gc = self.gcpolicy
-        config.translation.thread = self.use_threads
-        config.translation.simplifying = True
-        t = TranslationContext(config=config)
-        self.t = t
-        a = t.buildannotator(policy=annotatorpolicy)
-        a.build_types(func, argstypelist)
-        t.buildrtyper().specialize()
-        t.checkgraphs()
-        def compile():
-            cbuilder = CExtModuleBuilder(t, func, config=config)
-            c_source_filename = cbuilder.generate_source(
-                defines = cbuilder.DEBUG_DEFINES)
-            if conftest.option.view:
-                t.view()
-            cbuilder.compile()
-            self._cleanups.append(cbuilder.cleanup) # schedule cleanup after test
-            return cbuilder.get_entry_point(isolated=True)
-        return compile()
+        return compile(func, argstypelist, gcpolicy=self.gcpolicy, thread=self.use_threads)
 
 
 class TestUsingBoehm(AbstractGCTestClass):
diff --git a/pypy/translator/c/test/test_genc.py b/pypy/translator/c/test/test_genc.py
--- a/pypy/translator/c/test/test_genc.py
+++ b/pypy/translator/c/test/test_genc.py
@@ -14,7 +14,7 @@
 
 
 def compile(fn, argtypes, view=False, gcpolicy="none", backendopt=True,
-            annotatorpolicy=None):
+            annotatorpolicy=None, thread=False):
     argtypes_unroll = unrolling_iterable(enumerate(argtypes))
 
     for argtype in argtypes:
@@ -41,7 +41,7 @@
         return 0
 
     t = Translation(entry_point, None, gc=gcpolicy, backend="c",
-                    policy=annotatorpolicy)
+                    policy=annotatorpolicy, thread=thread)
     if not backendopt:
         t.disable(["backendopt_lltype"])
     t.annotate()
@@ -77,9 +77,10 @@
     f.__name__ = fn.__name__
     return f
 
+
 def test_simple():
     def f(x):
-        return x*2
+        return x * 2
 
     f1 = compile(f, [int])
 


More information about the pypy-commit mailing list