[pypy-svn] r70852 - pypy/branch/stringbuilder2/pypy/rpython/memory/test
arigo at codespeak.net
arigo at codespeak.net
Mon Jan 25 20:01:16 CET 2010
Author: arigo
Date: Mon Jan 25 20:01:15 2010
New Revision: 70852
Modified:
pypy/branch/stringbuilder2/pypy/rpython/memory/test/test_gc.py
Log:
Improve the test: checks that shrink_array()
did his job for exactly the correct GC classes.
Modified: pypy/branch/stringbuilder2/pypy/rpython/memory/test/test_gc.py
==============================================================================
--- pypy/branch/stringbuilder2/pypy/rpython/memory/test/test_gc.py (original)
+++ pypy/branch/stringbuilder2/pypy/rpython/memory/test/test_gc.py Mon Jan 25 20:01:15 2010
@@ -24,6 +24,7 @@
GC_PARAMS = {}
GC_CAN_MOVE = False
GC_CANNOT_MALLOC_NONMOVABLE = False
+ GC_CAN_SHRINK_ARRAY = False
def setup_class(cls):
cls._saved_logstate = py.log._getstate()
@@ -470,6 +471,7 @@
def test_shrink_array(self):
from pypy.rpython.lltypesystem.rstr import STR
+ GC_CAN_SHRINK_ARRAY = self.GC_CAN_SHRINK_ARRAY
def f():
ptr = lltype.malloc(STR, 3)
@@ -477,11 +479,12 @@
ptr.chars[0] = 'A'
ptr.chars[1] = 'B'
ptr.chars[2] = 'C'
- ptr = rgc.ll_shrink_array(ptr, 2)
- return ( ord(ptr.chars[0]) +
- (ord(ptr.chars[1]) << 8) +
- (len(ptr.chars) << 16) +
- (ptr.hash << 24))
+ ptr2 = rgc.ll_shrink_array(ptr, 2)
+ assert (ptr == ptr2) == GC_CAN_SHRINK_ARRAY
+ return ( ord(ptr2.chars[0]) +
+ (ord(ptr2.chars[1]) << 8) +
+ (len(ptr2.chars) << 16) +
+ (ptr2.hash << 24))
assert self.interpret(f, []) == 0x62024241
@@ -617,6 +620,7 @@
from pypy.rpython.memory.gc.semispace import SemiSpaceGC as GCClass
GC_CAN_MOVE = True
GC_CANNOT_MALLOC_NONMOVABLE = True
+ GC_CAN_SHRINK_ARRAY = True
class TestGrowingSemiSpaceGC(TestSemiSpaceGC):
GC_PARAMS = {'space_size': 64}
More information about the Pypy-commit
mailing list