[pypy-svn] rev 1581 - in pypy/trunk/src/pypy/translator: . test

hpk at codespeak.net hpk at codespeak.net
Sat Oct 4 18:21:53 CEST 2003


Author: hpk
Date: Sat Oct  4 18:21:52 2003
New Revision: 1581

Modified:
   pypy/trunk/src/pypy/translator/flowmodel.py
   pypy/trunk/src/pypy/translator/test/buildpyxmodule.py
   pypy/trunk/src/pypy/translator/test/test_sourcegen.py
Log:
got rid of some miscontrsucted testcase. 

now finally hopefully eventually all tests should pass

(run python test_all.py on the pypy-root)



Modified: pypy/trunk/src/pypy/translator/flowmodel.py
==============================================================================
--- pypy/trunk/src/pypy/translator/flowmodel.py	(original)
+++ pypy/trunk/src/pypy/translator/flowmodel.py	Sat Oct  4 18:21:52 2003
@@ -135,7 +135,7 @@
 
     def mkentrymap(self):
         """Create a map from nodes in the graph to back edge lists"""
-        entrymap = { self.startblock: []}
+        entrymap = { self.startblock: [self]}
         for node in self.flatten():
             for edge in node.getedges():
                 entrymap.setdefault(edge, []).append(node)

Modified: pypy/trunk/src/pypy/translator/test/buildpyxmodule.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/buildpyxmodule.py	(original)
+++ pypy/trunk/src/pypy/translator/test/buildpyxmodule.py	Sat Oct  4 18:21:52 2003
@@ -9,6 +9,9 @@
 
 def make_module_from_pyxstring(name, dirpath, string):
     pyxfile = dirpath.join('%s.pyx' % name) 
+    i = 0
+    while pyxfile.exists():
+        pyxfile = pyxfile.newbasename('%s%d.pyx' % (name, i))
     pyxfile.write(string)
     if debug: print "made pyxfile", pyxfile
     make_c_from_pyxfile(pyxfile)
@@ -42,6 +45,7 @@
           cmdclass = {'build_ext': build_ext},
           script_name = 'setup.py',
           script_args = ['-q', 'build_ext', '--inplace']
+          #script_args = ['build_ext', '--inplace']
         )
         # XXX not a nice way to import a module
         if debug: print "inserting path to sys.path", dirpath

Modified: pypy/trunk/src/pypy/translator/test/test_sourcegen.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_sourcegen.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_sourcegen.py	Sat Oct  4 18:21:52 2003
@@ -56,42 +56,6 @@
         self.assertEquals(mod.f(-1, 42), 42)
         self.assertEquals(mod.f(3, 5), 3)
 
-    def test_while(self):
-        """
-        one test source:
-        def f(i):
-            while i > 0:
-                i = i - 1
-            return i
-        """
-        i = Variable("i")
-        conditionres = Variable("conditionres")
-        conditionop = SpaceOperation("gt", [i, Constant(0)], conditionres)
-        decop = SpaceOperation("add", [i, Constant(-1)], i)
-
-        conditionbranch = ConditionalBranch()
-        headerbranch = Branch()
-        whileblock = BasicBlock([i], [i], [decop], headerbranch)
-        whilebranch = Branch([i], whileblock)
-        endbranch = EndBranch(i)
-        conditionbranch.set(conditionres, whilebranch, endbranch)
-
-        headerblock = BasicBlock([i], [i, conditionres],
-                                 [conditionop], conditionbranch)
-
-        headerbranch.set([i], headerblock)
-
-        startblock = BasicBlock([i], [i], 
-                                [], headerbranch)
-
-        fun = FunctionGraph(startblock, "f")
-        #make_ps(fun)
-        
-        result = GenPyrex(fun).emitcode()
-        mod = make_module_from_pyxstring('test_source3', udir, result)
-        self.assertEquals(mod.f(42), 0)
-        self.assertEquals(mod.f(-3), -3)
-
     def test_while_sum(self):
         """
         one test source:


More information about the Pypy-commit mailing list