[pypy-commit] pypy numpy-dtype-alt: added a failing test for raw memory with llgraph backend.

alex_gaynor noreply at buildbot.pypy.org
Sun Aug 21 04:07:41 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: numpy-dtype-alt
Changeset: r46677:e60bd91992f3
Date: 2011-08-20 21:12 -0500
http://bitbucket.org/pypy/pypy/changeset/e60bd91992f3/

Log:	added a failing test for raw memory with llgraph backend.

diff --git a/pypy/jit/metainterp/test/test_rawmem.py b/pypy/jit/metainterp/test/test_rawmem.py
new file mode 100644
--- /dev/null
+++ b/pypy/jit/metainterp/test/test_rawmem.py
@@ -0,0 +1,22 @@
+from pypy.jit.metainterp.test.support import LLJitMixin
+from pypy.rpython.lltypesystem import lltype, rffi
+
+
+class TestJITRawMem(LLJitMixin):
+    def test_cast_void_ptr(self):
+        TP = lltype.Array(lltype.Float, hints={"nolength": True})
+        VOID_TP = lltype.Array(lltype.Void, hints={"nolength": True})
+        class A(object):
+            def __init__(self, x):
+                self.storage = rffi.cast(lltype.Ptr(VOID_TP), x)\
+
+        def f(n):
+            x = lltype.malloc(TP, n, flavor="raw", zero=True)
+            a = A(x)
+            s = 0.0
+            rffi.cast(lltype.Ptr(TP), a.storage)[0] = 1.0
+            s += rffi.cast(lltype.Ptr(TP), a.storage)[0]
+            lltype.free(x, flavor="raw")
+            return s
+        res = self.interp_operations(f, [10])
+        assert res == 1.0
\ No newline at end of file


More information about the pypy-commit mailing list