[pypy-svn] r54369 - in pypy/branch/oo-jit/pypy/jit/codegen: cli/test ia32/test

antocuni at codespeak.net antocuni at codespeak.net
Sat May 3 16:18:19 CEST 2008


Author: antocuni
Date: Sat May  3 16:18:19 2008
New Revision: 54369

Added:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_portal.py   (contents, props changed)
Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_ts.py
   pypy/branch/oo-jit/pypy/jit/codegen/ia32/test/test_genc_portal.py
Log:
port test_portal to gencli; no test works so far



Added: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_portal.py
==============================================================================
--- (empty file)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_portal.py	Sat May  3 16:18:19 2008
@@ -0,0 +1,39 @@
+import py
+from pypy.tool.udir import udir
+from pypy.translator.cli.entrypoint import StandaloneEntryPoint
+from pypy.translator.cli.gencli import GenCli
+from pypy.translator.cli.sdk import SDK
+from pypy.jit.codegen.ia32.test.test_genc_portal import I386PortalTestMixin
+from pypy.jit.rainbow.test import test_portal
+from pypy.jit.codegen.cli.rgenop import RCliGenOp
+
+class CliPortalTestMixin(I386PortalTestMixin):
+    RGenOp = RCliGenOp
+
+    def getgraph(self, fn):
+        bk = self.rtyper.annotator.bookkeeper
+        return bk.getdesc(fn).getuniquegraph()
+
+    def compile(self, ll_main):
+        graph = self.getgraph(ll_main)
+        entrypoint = StandaloneEntryPoint(graph)
+        gen = GenCli(udir, self.rtyper.annotator.translator, entrypoint)
+        gen.generate_source()
+        self.executable_name = gen.build_exe()
+
+    def cmdexec(self, args=''):
+        assert self.executable_name
+        mono = ''.join(SDK.runtime())
+        return py.process.cmdexec('%s "%s" %s' % (mono, self.executable_name, args))
+
+
+class TestPortal(CliPortalTestMixin,
+                 test_portal.TestPortalOOType):
+
+    # for the individual tests see
+    # ====> ../../../rainbow/test/test_portal.py
+
+    def skip(self):
+        py.test.skip('in progress')
+        
+    test_cast_ptr_to_int = skip

Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_ts.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_ts.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/test/test_gencli_ts.py	Sat May  3 16:18:19 2008
@@ -1,4 +1,5 @@
 import py
+py.test.skip('port me')
 from pypy.tool.udir import udir
 from pypy.translator.cli.entrypoint import StandaloneEntryPoint
 from pypy.translator.cli.gencli import GenCli

Modified: pypy/branch/oo-jit/pypy/jit/codegen/ia32/test/test_genc_portal.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/ia32/test/test_genc_portal.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/ia32/test/test_genc_portal.py	Sat May  3 16:18:19 2008
@@ -22,7 +22,7 @@
 
         # ---------- run the stand-alone executable ----------
         cmdargs = ' '.join([str(arg) for arg in main_args])
-        output = self.cbuilder.cmdexec(cmdargs)
+        output = self.cmdexec(cmdargs)
         lines = output.split()
         lastline = lines[-1]
         assert not lastline.startswith('EXCEPTION:')
@@ -78,19 +78,26 @@
             backendoptimize=backendoptimize)
 
         # ---------- generate a stand-alone executable ----------
-        t = self.rtyper.annotator.translator
-        t.config.translation.gc = 'boehm'
-        self.cbuilder = CStandaloneBuilder(t, ll_main, config=t.config)
-        self.cbuilder.generate_source()
-        exename = self.cbuilder.compile()
+        exename = self.compile(ll_main)
         print '-'*60
         print 'Generated executable for %s: %s' % (self.testname, exename)
         print '-'*60
 
-
     def check_insns(self, expected=None, **counts):
         "Cannot check instructions in the generated assembler."
 
+    def compile(self, ll_main):
+        t = self.rtyper.annotator.translator
+        t.config.translation.gc = 'boehm'
+        cbuilder = CStandaloneBuilder(t, ll_main, config=t.config)
+        cbuilder.generate_source()
+        exename = cbuilder.compile()
+        self.main_cbuilder= cbuilder
+        return exename
+
+    def cmdexec(self, args):
+        return self.main_cbuilder.cmdexec(args)
+
 
 class TestPortal(I386PortalTestMixin,
                  test_portal.TestPortalLLType):



More information about the Pypy-commit mailing list