[pypy-svn] r28909 - pypy/dist/pypy/translator/backendopt/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Jun 17 12:08:11 CEST 2006


Author: cfbolz
Date: Sat Jun 17 12:08:10 2006
New Revision: 28909

Modified:
   pypy/dist/pypy/translator/backendopt/test/test_escape.py
   pypy/dist/pypy/translator/backendopt/test/test_support.py
Log:
move test to where it belongs


Modified: pypy/dist/pypy/translator/backendopt/test/test_escape.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/test/test_escape.py	(original)
+++ pypy/dist/pypy/translator/backendopt/test/test_escape.py	Sat Jun 17 12:08:10 2006
@@ -404,32 +404,6 @@
     assert not state.does_escape()
 
 
-#__________________________________________________________
-# test loop detection
-
-def test_find_backedges():
-    def f(k):
-        result = 0
-        for i in range(k):
-            result += 1
-        for j in range(k):
-            result += 1
-        return result
-    t, adi, graph = build_adi(f, [int])
-    backedges = find_backedges(graph)
-    assert len(backedges) == 2
-
-def test_find_loop_blocks():
-    def f(k):
-        result = 0
-        for i in range(k):
-            result += 1
-        for j in range(k):
-            result += 1
-        return result
-    t, adi, graph = build_adi(f, [int])
-    loop_blocks = find_loop_blocks(graph)
-    assert len(loop_blocks) == 4
 
 #__________________________________________________________
 # malloc removal tests

Modified: pypy/dist/pypy/translator/backendopt/test/test_support.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/test/test_support.py	(original)
+++ pypy/dist/pypy/translator/backendopt/test/test_support.py	Sat Jun 17 12:08:10 2006
@@ -1,5 +1,7 @@
+from pypy.translator.translator import TranslationContext, graphof
 from pypy.translator.backendopt.support import \
-     needs_conservative_livevar_calculation, split_block_with_keepalive
+     needs_conservative_livevar_calculation, split_block_with_keepalive, \
+     find_loop_blocks, find_backedges
 
 from pypy.rpython.rtyper import LowLevelOpList
 from pypy.rpython.lltypesystem import lltype
@@ -91,4 +93,36 @@
     link = split_block_with_keepalive(block, 1)
     assert 'keepalive' in [op.opname for op in link.target.operations]
 
+#__________________________________________________________
+# test loop detection
+
+def test_find_backedges():
+    def f(k):
+        result = 0
+        for i in range(k):
+            result += 1
+        for j in range(k):
+            result += 1
+        return result
+    t = TranslationContext()
+    t.buildannotator().build_types(f, [int])
+    t.buildrtyper().specialize()
+    graph = graphof(t, f)
+    backedges = find_backedges(graph)
+    assert len(backedges) == 2
+
+def test_find_loop_blocks():
+    def f(k):
+        result = 0
+        for i in range(k):
+            result += 1
+        for j in range(k):
+            result += 1
+        return result
+    t = TranslationContext()
+    t.buildannotator().build_types(f, [int])
+    t.buildrtyper().specialize()
+    graph = graphof(t, f)
+    loop_blocks = find_loop_blocks(graph)
+    assert len(loop_blocks) == 4
 



More information about the Pypy-commit mailing list