[pypy-svn] r73690 - pypy/branch/cpython-extension/pypy/translator/c/gcc/test

fijal at codespeak.net fijal at codespeak.net
Tue Apr 13 01:48:01 CEST 2010


Author: fijal
Date: Tue Apr 13 01:48:00 2010
New Revision: 73690

Modified:
   pypy/branch/cpython-extension/pypy/translator/c/gcc/test/test_asmgcroot.py
Log:
fix the test


Modified: pypy/branch/cpython-extension/pypy/translator/c/gcc/test/test_asmgcroot.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/translator/c/gcc/test/test_asmgcroot.py	(original)
+++ pypy/branch/cpython-extension/pypy/translator/c/gcc/test/test_asmgcroot.py	Tue Apr 13 01:48:00 2010
@@ -7,7 +7,7 @@
 from pypy import conftest
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.rlib.entrypoint import entrypoint
+from pypy.rlib.entrypoint import entrypoint, secondary_entrypoints
 
 class AbstractTestAsmGCRoot:
     # the asmgcroot gc transformer doesn't generate gc_reload_possibly_moved
@@ -20,8 +20,6 @@
         config = get_pypy_config(translating=True)
         config.translation.gc = cls.gcpolicy
         config.translation.gcrootfinder = "asmgcc"
-        config.translation.secondaryentrypoints = 'x42'
-        # ^^^  from secondary entry point test
         return config
 
     @classmethod
@@ -39,11 +37,14 @@
         config = cls.make_config()
         t = TranslationContext(config=config)
         a = t.buildannotator()
+        for f, inputtypes in cls.secondary_entrypoints:
+            a.build_types(f, inputtypes, False)
         a.build_types(main, [s_list_of_strings])
         t.buildrtyper().specialize()
         t.checkgraphs()
 
-        cbuilder = CStandaloneBuilder(t, main, config=config)
+        cbuilder = CStandaloneBuilder(t, main, config=config,
+                secondary_entrypoints=cls.secondary_entrypoints)
         c_source_filename = cbuilder.generate_source(
             defines = cbuilder.DEBUG_DEFINES)
         cls._patch_makefile(cbuilder.targetdir)
@@ -111,6 +112,7 @@
                                    test_newgc.TestSemiSpaceGC):
     # for the individual tests see
     # ====> ../../test/test_newgc.py
+    secondary_entrypoints = []
 
     def define_large_function(cls):
         class A(object):
@@ -158,7 +160,6 @@
 
         return f
 
-
     def test_callback_simple(self):
         res = self.run('callback_simple')
         assert res == 4900
@@ -170,27 +171,25 @@
             return a + b
 
         c_source = py.code.Source("""
-        int mystuff()
+        int mystuff2()
         {
             return callback(40, 2) + callback(3, 4);
         }
         """)
 
         eci = ExternalCompilationInfo(separate_module_sources=[c_source])
-        z = rffi.llexternal('mystuff', [], lltype.Signed,
+        z = rffi.llexternal('mystuff2', [], lltype.Signed,
                             compilation_info=eci)
         S = lltype.GcStruct('S', ('x', lltype.Signed))
 
+        self.secondary_entrypoints.extend(secondary_entrypoints["x42"])
+
         def f():
             p = lltype.malloc(S)
             p.x = 100
             result = z()
             return result * p.x
 
-        def update_config(config):
-            config.translation.secondaryentrypoints = 'x42'
-
-        f.update_config = update_config
         return f
 
     def test_secondary_entrypoint_callback(self):



More information about the Pypy-commit mailing list