[pypy-commit] stmgc copy-over-original2: More test fixes

arigo noreply at buildbot.pypy.org
Thu Jul 25 17:39:52 CEST 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: copy-over-original2
Changeset: r439:c00f65b25cce
Date: 2013-07-25 17:39 +0200
http://bitbucket.org/pypy/stmgc/changeset/c00f65b25cce/

Log:	More test fixes

diff --git a/c4/test/support.py b/c4/test/support.py
--- a/c4/test/support.py
+++ b/c4/test/support.py
@@ -589,22 +589,16 @@
     p1.h_tid |= GCFLAG_PUBLIC_TO_PRIVATE
     if p1.h_tid & GCFLAG_PREBUILT_ORIGINAL:
         lib.stm_add_prebuilt_root(p1)
+    # no h_original or it is a prebuilt with a specified hash in h_original
     assert p2.h_original == 0
     assert p1 != p2
+    assert p1.h_tid & GCFLAG_OLD
+    assert p2.h_tid & GCFLAG_OLD
     if (p1.h_original == 0) or (p1.h_tid & GCFLAG_PREBUILT_ORIGINAL):
         p2.h_original = ffi.cast("revision_t", p1)
     else:
         p2.h_original = p1.h_original
 
-def delegate_original(p1, p2):
-    # no h_original or it is a prebuilt with a specified hash in h_original
-    assert (p1.h_original == 0) or (p1.h_tid & GCFLAG_PREBUILT_ORIGINAL)
-    assert p1.h_tid & GCFLAG_OLD
-    assert p2.h_original == 0
-    assert p1 != p2
-    p2.h_original = ffi.cast("revision_t", p1)
-
-
 def make_public(p1):
     """Hack at an object returned by oalloc() to force it public."""
     assert classify(p1) == "protected"
diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py
--- a/c4/test/test_gcpage.py
+++ b/c4/test/test_gcpage.py
@@ -250,41 +250,43 @@
     major_collect()
     lib.stm_pop_root()
     check_not_free(p1)
-    check_free_old(p2)
+    check_not_free(p2)
     check_free_old(p3)
     check_free_old(p4)
-    check_not_free(p5)
+    check_free_old(p5)
     print 'p1:', p1
     print '      containing:', rawgetptr(p1, 0)
     print 'p2:', p2
     print 'p3:', p3
     print 'p4:', p4
     print 'p5:', p5
-    assert rawgetptr(p1, 0) == p5
+    assert rawgetptr(p1, 0) == p2
 
 def test_new_version_not_kill_intermediate_original():
     p1 = oalloc_refs(1); make_public(p1)
-    p2 = oalloc(HDR);    make_public(p2)
-    p3 = oalloc(HDR);    make_public(p3)
-    p4 = oalloc(HDR);    make_public(p4)
-    p5 = oalloc(HDR);    make_public(p5)
+    p2 = oalloc(HDR + WORD); make_public(p2)
+    p3 = oalloc(HDR + WORD); make_public(p3)
+    p4 = oalloc(HDR + WORD); make_public(p4)
+    p5 = oalloc(HDR + WORD); make_public(p5)
     delegate(p2, p3)
     delegate(p3, p4)
     delegate(p4, p5)
     rawsetptr(p1, 0, p3)
-    delegate_original(p3, p2)
-    delegate_original(p3, p4)
-    delegate_original(p3, p5)
+    lib.rawsetlong(p2, 0, 222)
+    lib.rawsetlong(p3, 0, 333)
+    lib.rawsetlong(p4, 0, 444)
+    lib.rawsetlong(p5, 0, 555)
 
     lib.stm_push_root(p1)
     major_collect()
     lib.stm_pop_root()
     check_not_free(p1)
-    check_free_old(p2)
-    check_not_free(p3) # original
+    check_not_free(p2)
+    check_free_old(p3)
     check_free_old(p4)
     check_free_old(p5)
-    assert rawgetptr(p1, 0) == p3
+    assert rawgetptr(p1, 0) == p2
+    assert lib.rawgetlong(p2, 0) == 555   # copied over from p5
     
 def test_prebuilt_version_1():
     p1 = lib.pseudoprebuilt(HDR, 42 + HDR)


More information about the pypy-commit mailing list