[pypy-svn] r46352 - pypy/dist/pypy/translator/test
arigo at codespeak.net
arigo at codespeak.net
Wed Sep 5 18:27:57 CEST 2007
Author: arigo
Date: Wed Sep 5 18:27:57 2007
New Revision: 46352
Modified:
pypy/dist/pypy/translator/test/test_simplify.py
Log:
These two tests were too precise.
Modified: pypy/dist/pypy/translator/test/test_simplify.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_simplify.py (original)
+++ pypy/dist/pypy/translator/test/test_simplify.py Wed Sep 5 18:27:57 2007
@@ -29,7 +29,7 @@
def f(x):
os.close(x)
graph, _ = translate(f, [int])
- assert len(graph.startblock.operations) == 2
+ assert len(graph.startblock.operations) > 0
def test_remove_recursive_call():
def rec(a):
@@ -140,13 +140,24 @@
print op
graph = get_graph(op.args[0], t)
assert graph is not None
+ # an external function in RPython turns currently into
+ # a call to a wrapper function which itself contains the
+ # real call to a graph-less external ll function, so
+ # we check recursively
graph, t = translate(external_function, [], False)
- for block in graph.iterblocks():
- for op in block.operations:
- if op.opname == "direct_call":
- print op
- graph = get_graph(op.args[0], t)
- assert graph is None
+ found = []
+ def walkgraph(graph):
+ for block in graph.iterblocks():
+ for op in block.operations:
+ if op.opname == "direct_call":
+ print op
+ subgraph = get_graph(op.args[0], t)
+ if subgraph is None:
+ found.append(op)
+ else:
+ walkgraph(subgraph)
+ walkgraph(graph)
+ assert len(found) == 1
def addone(x):
return x + 1
More information about the Pypy-commit
mailing list