[pypy-commit] pypy kill-running_on_llinterp: Replace test using running_on_llinterp directly by another test that uses running_on_llinterp indirectly through register_external.
Manuel Jacob
noreply at buildbot.pypy.org
Mon Jan 27 22:03:56 CET 2014
Author: Manuel Jacob
Branch: kill-running_on_llinterp
Changeset: r68967:cd8bd484b255
Date: 2014-01-27 19:58 +0100
http://bitbucket.org/pypy/pypy/changeset/cd8bd484b255/
Log: Replace test using running_on_llinterp directly by another test that
uses running_on_llinterp indirectly through register_external.
diff --git a/rpython/rtyper/test/test_extfunc.py b/rpython/rtyper/test/test_extfunc.py
--- a/rpython/rtyper/test/test_extfunc.py
+++ b/rpython/rtyper/test/test_extfunc.py
@@ -1,10 +1,9 @@
import py
-from rpython.rtyper.extfunc import ExtFuncEntry, register_external,\
- is_external, lazy_register
from rpython.annotator import model as annmodel
from rpython.annotator.annrpython import RPythonAnnotator
from rpython.annotator.policy import AnnotatorPolicy
+from rpython.rtyper.extfunc import ExtFuncEntry, register_external
from rpython.rtyper.test.test_llinterp import interpret
class TestExtFuncEntry:
@@ -173,4 +172,21 @@
py.test.raises(Exception, a.build_types, g, [[str]])
a.build_types(g, [[str0]]) # Does not raise
+ def test_register_external_llfakeimpl(self):
+ def a(i):
+ return i
+ def a_llimpl(i):
+ return i * 2
+ def a_llfakeimpl(i):
+ return i * 3
+ register_external(a, [int], int, llimpl=a_llimpl,
+ llfakeimpl=a_llfakeimpl)
+ def f(i):
+ return a(i)
+ res = interpret(f, [7])
+ assert res == 21
+
+ from rpython.translator.c.test.test_genc import compile
+ fc = compile(f, [int])
+ assert fc(7) == 14
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
@@ -3,8 +3,7 @@
import py
-from rpython.rlib.debug import llinterpcall
-from rpython.rlib.objectmodel import instantiate, running_on_llinterp, compute_unique_id, current_object_addr_as_int
+from rpython.rlib.objectmodel import instantiate, compute_unique_id, current_object_addr_as_int
from rpython.rlib.rarithmetic import (intmask, longlongmask, r_int64, is_valid_int,
r_int, r_uint, r_longlong, r_ulonglong)
from rpython.rlib.rstring import StringBuilder, UnicodeBuilder
@@ -415,26 +414,6 @@
res = self.interpret(fn, [3.25])
assert res == 7.25
- def test_debug_llinterpcall(self):
- S = lltype.Struct('S', ('m', lltype.Signed))
- SPTR = lltype.Ptr(S)
- def foo(n):
- "NOT_RPYTHON"
- s = lltype.malloc(S, immortal=True)
- s.m = eval("n*6", locals())
- return s
- def fn(n):
- if running_on_llinterp:
- return llinterpcall(SPTR, foo, n).m
- else:
- return 321
- res = self.interpret(fn, [7])
- assert res == 42
- from rpython.translator.c.test.test_genc import compile
- f = compile(fn, [int])
- res = f(7)
- assert res == 321
-
def test_id(self):
class A:
pass
More information about the pypy-commit
mailing list