[pypy-commit] pypy gc-incminimark-pinning: import test from gc-minimark-pinning.

groggi noreply at buildbot.pypy.org
Mon Jun 2 17:24:21 CEST 2014


Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning
Changeset: r71837:98f3f8e85506
Date: 2014-05-20 14:32 +0200
http://bitbucket.org/pypy/pypy/changeset/98f3f8e85506/

Log:	import test from gc-minimark-pinning.

diff --git a/rpython/memory/test/gc_test_base.py b/rpython/memory/test/gc_test_base.py
--- a/rpython/memory/test/gc_test_base.py
+++ b/rpython/memory/test/gc_test_base.py
@@ -792,6 +792,24 @@
             assert rgc.get_gcflag_extra(a2) == False
         self.interpret(fn, [])
 
+    def test_pinning(self):
+        def fn(n):
+            s = str(n)
+            if not rgc.can_move(s):
+                return 13
+            res = int(rgc.pin(s))
+            if res:
+                rgc.unpin(s)
+            return res
+
+        res = self.interpret(fn, [10])
+        if not self.GCClass.moving_gc:
+            assert res == 13
+        elif self.GCClass.can_usually_pin_objects:
+            assert res == 1
+        else:
+            assert res == 0 or res == 13
+
 from rpython.rlib.objectmodel import UnboxedValue
 
 class TaggedBase(object):


More information about the pypy-commit mailing list