[pypy-svn] r54672 - pypy/branch/hybrid-io/pypy/translator/c/test

fijal at codespeak.net fijal at codespeak.net
Mon May 12 13:45:31 CEST 2008


Author: fijal
Date: Mon May 12 13:45:29 2008
New Revision: 54672

Modified:
   pypy/branch/hybrid-io/pypy/translator/c/test/test_boehm.py
Log:
Test malloc_nonmovable on top of boehm as well


Modified: pypy/branch/hybrid-io/pypy/translator/c/test/test_boehm.py
==============================================================================
--- pypy/branch/hybrid-io/pypy/translator/c/test/test_boehm.py	(original)
+++ pypy/branch/hybrid-io/pypy/translator/c/test/test_boehm.py	Mon May 12 13:45:29 2008
@@ -377,6 +377,23 @@
         c_fn = self.getcompiled(fn, [])
         assert c_fn() == False
 
+    def test_malloc_nonmovable(self):
+        TP = lltype.GcArray(lltype.Char)
+        def func():
+            try:
+                from pypy.rlib import rgc
+                a = rgc.malloc_nonmovable(TP, 3)
+                rgc.collect()
+                if a:
+                    assert not rgc.can_move(a)
+                    return 0
+                return 1
+            except Exception, e:
+                return 2
+
+        run = self.getcompiled(func)
+        assert run() == 0
+
     def test_resizable_buffer(self):
         from pypy.rpython.lltypesystem.rstr import STR
         from pypy.rpython.annlowlevel import hlstr



More information about the Pypy-commit mailing list