Author: Manuel Jacob
Branch: llvm-translation-backend
Changeset: r68887:120355abd906
Date: 2014-01-23 22:29 +0100
http://bitbucket.org/pypy/pypy/changeset/120355abd906/
Log: Remove hacks formerly required to run RTyper tests on top of
GenLLVM.
diff --git a/rpython/rtyper/test/test_rbuiltin.py
b/rpython/rtyper/test/test_rbuiltin.py
--- a/rpython/rtyper/test/test_rbuiltin.py
+++ b/rpython/rtyper/test/test_rbuiltin.py
@@ -267,7 +267,7 @@
except OSError:
pass
count = 0
- for dir_call in enum_direct_calls(self.translator, fn):
+ for dir_call in
enum_direct_calls(test_llinterp.typer.annotator.translator, fn):
cfptr = dir_call.args[0]
assert self.get_callable(cfptr.value).__name__.startswith('dup')
count += 1
@@ -282,7 +282,7 @@
res = self.interpret(f, [])
os.close(res)
count = 0
- for dir_call in enum_direct_calls(self.translator, wr_open):
+ for dir_call in
enum_direct_calls(test_llinterp.typer.annotator.translator, wr_open):
cfptr = dir_call.args[0]
assert
self.get_callable(cfptr.value).__name__.startswith('os_open')
count += 1
diff --git a/rpython/rtyper/test/test_rlist.py
b/rpython/rtyper/test/test_rlist.py
--- a/rpython/rtyper/test/test_rlist.py
+++ b/rpython/rtyper/test/test_rlist.py
@@ -82,6 +82,15 @@
self.check_list(l1, expected)
+# helper used by some tests below
+def list_is_clear(lis, idx):
+ items = lis._obj.items._obj.items
+ for i in range(idx, len(items)):
+ if items[i]._obj is not None:
+ return False
+ return True
+
+
class TestListImpl(BaseTestListImpl):
def sample_list(self): # [42, 43, 44, 45]
rlist = ListRepr(None, signed_repr)
@@ -1475,13 +1484,6 @@
assert r_A_list.lowleveltype == r_B_list.lowleveltype
- def list_is_clear(self, lis, idx):
- items = lis._obj.items._obj.items
- for i in range(idx, len(items)):
- if items[i]._obj is not None:
- return False
- return True
-
def test_no_unneeded_refs(self):
def fndel(p, q):
lis = ["5", "3", "99"]
@@ -1497,10 +1499,10 @@
return lis
for i in range(2, 3+1):
lis = self.interpret(fndel, [0, i])
- assert self.list_is_clear(lis, 3-i)
+ assert list_is_clear(lis, 3-i)
for i in range(3):
lis = self.interpret(fnpop, [i])
- assert self.list_is_clear(lis, 3-i)
+ assert list_is_clear(lis, 3-i)
def test_oopspec(self):
lst1 = [123, 456] # non-mutated list
diff --git a/rpython/rtyper/test/test_rvirtualizable.py
b/rpython/rtyper/test/test_rvirtualizable.py
--- a/rpython/rtyper/test/test_rvirtualizable.py
+++ b/rpython/rtyper/test/test_rvirtualizable.py
@@ -367,7 +367,9 @@
def test_simple(self):
def f(v):
vinst = V(v)
- return vinst
+ return vinst, vinst.v
res = self.interpret(f, [42])
+ assert res.item1 == 42
+ res = lltype.normalizeptr(res.item0)
assert res.inst_v == 42
assert res.vable_token == lltype.nullptr(llmemory.GCREF.TO)
diff --git a/rpython/rtyper/test/test_rweakref.py
b/rpython/rtyper/test/test_rweakref.py
--- a/rpython/rtyper/test/test_rweakref.py
+++ b/rpython/rtyper/test/test_rweakref.py
@@ -43,10 +43,7 @@
r = w1
else:
r = w2
- obj = r()
- if obj is None:
- return -1
- return obj.hello
+ return r().hello
res = self.interpret(f, [1])
assert res == 5
res = self.interpret(f, [0])
diff --git a/rpython/rtyper/test/tool.py b/rpython/rtyper/test/tool.py
--- a/rpython/rtyper/test/tool.py
+++ b/rpython/rtyper/test/tool.py
@@ -1,6 +1,5 @@
import py
from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.test import test_llinterp
from rpython.rtyper.test.test_llinterp import gengraph, interpret,
interpret_raises
class BaseRtypingTest(object):
@@ -36,10 +35,6 @@
def is_of_type(self, x, type_):
return type(x) is type_
- @property
- def translator(self):
- return test_llinterp.typer.annotator.translator
-
def _skip_llinterpreter(self, reason):
py.test.skip("lltypesystem doesn't support %s, yet" % reason)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit