Author: Remi Meier <meier...@student.ethz.ch>
Branch: 
Changeset: r374:ef8442a75174
Date: 2013-07-08 14:37 +0200
http://bitbucket.org/pypy/stmgc/changeset/ef8442a75174/

Log:    A test that fails. Maybe should fail, waiting for arigato's OK

diff --git a/c4/test/test_et.py b/c4/test/test_et.py
--- a/c4/test/test_et.py
+++ b/c4/test/test_et.py
@@ -204,6 +204,36 @@
     assert p4 == p2
     assert list_of_read_objects() == [p2]
 
+def test_write_barrier_after_minor_collect():
+    # maybe should fail. not sure.
+    p = oalloc_refs(1)
+    pw = lib.stm_write_barrier(p)
+
+    lib.stm_push_root(pw)
+    minor_collect()
+    r = nalloc(HDR)
+    pw = lib.stm_pop_root()
+
+    assert pw.h_tid & GCFLAG_OLD
+    rawsetptr(pw, 0, r)
+
+    # pw not in old_objects_to_trace. A
+    # repeated write_barrier before
+    # rawsetptr() would fix that
+    
+    lib.stm_push_root(r)
+    minor_collect()
+    r2 = lib.stm_pop_root()
+    check_nursery_free(r)
+    
+    pr = lib.stm_read_barrier(p)
+    assert r != r2
+    # these will fail because pw/pr was
+    # not traced in the last minor_collect,
+    # because they were not registered in
+    # old_objects_to_trace.
+    assert getptr(pr, 0) != r
+    assert getptr(pr, 0) == r2
 
 def test_id_young_to_old():
     # move out of nursery with shadow original
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to