[pypy-svn] r25042 - in pypy/dist/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Mon Mar 27 17:29:17 CEST 2006


Author: antocuni
Date: Mon Mar 27 17:28:57 2006
New Revision: 25042

Modified:
   pypy/dist/pypy/translator/cli/conftest.py
   pypy/dist/pypy/translator/cli/cts.py
   pypy/dist/pypy/translator/cli/function.py
   pypy/dist/pypy/translator/cli/gencli.py
   pypy/dist/pypy/translator/cli/test/compile.py
   pypy/dist/pypy/translator/cli/test/runtest.py
Log:
Fixed conftest-related bug (I hope!)


Modified: pypy/dist/pypy/translator/cli/conftest.py
==============================================================================
--- pypy/dist/pypy/translator/cli/conftest.py	(original)
+++ pypy/dist/pypy/translator/cli/conftest.py	Mon Mar 27 17:28:57 2006
@@ -17,3 +17,4 @@
           Option('--nostop', action="store_true", dest="nostop", default=False,
                  help="don't stop on warning. The generated IL code could not compile")
           )
+

Modified: pypy/dist/pypy/translator/cli/cts.py
==============================================================================
--- pypy/dist/pypy/translator/cli/cts.py	(original)
+++ pypy/dist/pypy/translator/cli/cts.py	Mon Mar 27 17:28:57 2006
@@ -4,7 +4,7 @@
 
 from pypy.rpython.lltypesystem.lltype import Signed, Unsigned, Void, Bool, Float
 from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong
-from pypy.translator.cli import conftest
+from pypy.translator.cli.options import getoption
 
 from pypy.tool.ansi_print import ansi_log
 import py
@@ -35,7 +35,7 @@
     try:
         return _lltype_to_cts[t]
     except KeyError:
-        if conftest.option.nostop:
+        if getoption('nostop'):
             log.WARNING('Unknown type %s' % t)
             return t
         else:
@@ -48,7 +48,7 @@
     try:
         return _cts_to_ilasm[t]
     except KeyError:
-        if conftest.option.nostop:
+        if getoption('nostop'):
             log.WARNING('Unknown ilasm type %s' % t)
             return t
         else:

Modified: pypy/dist/pypy/translator/cli/function.py
==============================================================================
--- pypy/dist/pypy/translator/cli/function.py	(original)
+++ pypy/dist/pypy/translator/cli/function.py	Mon Mar 27 17:28:57 2006
@@ -1,6 +1,6 @@
 from pypy.objspace.flow import model as flowmodel
 from pypy.rpython.lltypesystem.lltype import Void
-from pypy.translator.cli import conftest
+from pypy.translator.cli.options import getoption
 from pypy.translator.cli import cts
 from pypy.translator.cli.opcodes import opcodes, DoNothing, PushArgs
 
@@ -140,7 +140,7 @@
         elif opname == 'direct_call':
             self._call(op)
         else:
-            if conftest.option.nostop:
+            if getoption('nostop'):
                 log.WARNING('Unknown opcode: %s ' % op)
                 self.ilasm.opcode(str(op))
             else:

Modified: pypy/dist/pypy/translator/cli/gencli.py
==============================================================================
--- pypy/dist/pypy/translator/cli/gencli.py	(original)
+++ pypy/dist/pypy/translator/cli/gencli.py	Mon Mar 27 17:28:57 2006
@@ -3,6 +3,8 @@
 from pypy.translator.cli import conftest
 from pypy.translator.cli.ilgenerator import IlasmGenerator
 from pypy.translator.cli.function import Function
+from pypy.translator.cli.options import getoption
+
 
 class Tee(object):
     def __init__(self, *args):
@@ -32,7 +34,7 @@
 
     def generate_source(self):
         out = self.tmpfile.open('w')
-        if conftest.option.stdout:
+        if getoption('stdout'):
             out = Tee(sys.stdout, out)
 
         self.ilasm = IlasmGenerator(out, self.assembly_name)

Modified: pypy/dist/pypy/translator/cli/test/compile.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/compile.py	(original)
+++ pypy/dist/pypy/translator/cli/test/compile.py	Mon Mar 27 17:28:57 2006
@@ -2,7 +2,7 @@
 
 import sys
 import py
-from pypy.rpython.rarithmetic import r_int, r_uint, r_ulonglong, r_longlong
+from pypy.rpython.rarithmetic import r_int, r_uint, r_ulonglong, r_longlong, ovfcheck
 from pypy.translator.test import snippet as s
 from pypy.translator.cli import conftest
 from pypy.translator.cli.test.runtest import compile_function
@@ -24,11 +24,31 @@
         print 'OK'
 
 
+def foo(x):
+    pass
+
+def xxx():
+    pass
+
+def bar(x, y):
+    try:
+        foo(x)
+        z = ovfcheck(x+y)
+        xxx()
+        return z
+    except OverflowError:
+        while x:
+            x = x-1
+        return x
+    except IndexError:
+        return 52
+            
 
 def bar(x, y):
-    return x and (not y)
+    foo(x)
+    foo(None)
 
-f = compile_function(bar, [r_uint, r_uint])
+f = compile_function(bar, [int, int])
 
 try:
     check(f, bar, r_uint(sys.maxint+1), r_uint(42))

Modified: pypy/dist/pypy/translator/cli/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/runtest.py	(original)
+++ pypy/dist/pypy/translator/cli/test/runtest.py	Mon Mar 27 17:28:57 2006
@@ -5,8 +5,7 @@
 import py
 from pypy.tool.udir import udir
 from pypy.translator.translator import TranslationContext
-from pypy.translator.cli import conftest
-from pypy.conftest import option
+from pypy.translator.cli.options import getoption
 from pypy.translator.cli.gencli import GenCli
 from pypy.translator.cli.function import Node
 from pypy.translator.cli.cts import graph_to_signature
@@ -95,10 +94,10 @@
         t.buildrtyper(type_system="ootype").specialize()
         self.graph = t.graphs[0]
 
-        if option.view:
+        if getoption('view'):
            t.viewcg()
 
-        if option.wd:
+        if getoption('wd'):
             tmpdir = py.path.local('.')
         else:
             tmpdir = udir
@@ -120,7 +119,7 @@
 
     def _build_exe(self):        
         tmpfile = self._gen.generate_source()
-        if option.source:
+        if getoption('source'):
             return None
 
         self.__check_helper("ilasm")



More information about the Pypy-commit mailing list