[pypy-commit] pypy rgc-mem-pressure: add a gc test

justinpeel noreply at buildbot.pypy.org
Sat Oct 8 06:42:27 CEST 2011


Author: Justin Peel <notmuchtotell at gmail.com>
Branch: rgc-mem-pressure
Changeset: r47870:dc3a8493fc44
Date: 2011-10-07 22:42 -0600
http://bitbucket.org/pypy/pypy/changeset/dc3a8493fc44/

Log:	add a gc test

diff --git a/pypy/rpython/memory/gctransform/framework.py b/pypy/rpython/memory/gctransform/framework.py
--- a/pypy/rpython/memory/gctransform/framework.py
+++ b/pypy/rpython/memory/gctransform/framework.py
@@ -389,7 +389,7 @@
             self.raw_malloc_memory_pressure = getfn(
                 raw_malloc_memory_pressure,
                 [annmodel.SomeInteger()],
-                annmode.s_None, minimal_transform = False)
+                annmodel.s_None, minimal_transform = False)
 
 
         self.identityhash_ptr = getfn(GCClass.identityhash.im_func,
diff --git a/pypy/translator/c/test/test_newgc.py b/pypy/translator/c/test/test_newgc.py
--- a/pypy/translator/c/test/test_newgc.py
+++ b/pypy/translator/c/test/test_newgc.py
@@ -128,10 +128,10 @@
         if not args:
             args = (-1, )
         res = self.allfuncs(name, *args)
-        num = self.name_to_func[name]        
+        num = self.name_to_func[name]
         if self.funcsstr[num]:
             return res
-        return int(res)        
+        return int(res)
 
     def define_empty_collect(cls):
         def f():
@@ -1458,6 +1458,33 @@
         res = self.run("nongc_attached_to_gc")
         assert res == -99997
 
+    def define_nongc_opaque_attached_to_gc(cls):
+        from pypy.rpython.lltypesystem import rffi
+        from pypy.rlib import ropenssl
+        class A:
+            def __init__(self):
+                self.ctx = lltype.malloc(ropenssl.EVP_MD_CTX.TO,
+                    flavor='raw')
+                digest = ropenssl.EVP_get_digestbyname('sha1')
+                ropenssl.EVP_DigestInit(self.ctx, digest)
+            def __del__(self):
+                ropenssl.EVP_MD_CTX_cleanup(self.ctx)
+                lltype.free(self.ctx, flavor='raw')
+        A()
+        def f():
+            am1 = am2 = am3 = None
+            for i in range(100000):
+                am3 = am2
+                am2 = am1
+                am1 = A()
+            # what can we use for the res?
+            return 0
+        return f
+
+    def test_nongc_opaque_attached_to_gc(self):
+        res = self.run("nongc_opaque_attached_to_gc")
+        assert res == 0
+
 # ____________________________________________________________________
 
 class TaggedPointersTest(object):


More information about the pypy-commit mailing list