Author: Remi Meier <[email protected]>
Branch: c8-new-page-handling
Changeset: r1424:d68c60689ca5
Date: 2014-09-24 15:45 +0200
http://bitbucket.org/pypy/stmgc/changeset/d68c60689ca5/
Log: another issue of go_to_the_future
diff --git a/c8/test/test_basic.py b/c8/test/test_basic.py
--- a/c8/test/test_basic.py
+++ b/c8/test/test_basic.py
@@ -252,7 +252,8 @@
py.test.raises(Conflict, self.commit_transaction)
assert res == 'a'
- def test_read_write_15(self):
+ @py.test.mark.parametrize("only_bk", [0, 1])
+ def test_read_write_15(self, only_bk):
lp1 = stm_allocate_old(16) # allocated in seg0
lp2 = stm_allocate_old(16) # allocated in seg0
stm_get_real_address(lp1)[HDR] = 'a' #setchar
@@ -270,16 +271,18 @@
stm_set_char(lp2, 'C')
self.commit_transaction() # R1
assert last_commit_log_entries() == [lp2] # commit 'C'
- self.start_transaction()
- stm_set_char(lp2, 'c') # R1.1
+ if only_bk:
+ self.start_transaction()
+ stm_set_char(lp2, 'c') # R1.1
#
self.switch(2)
self.start_transaction()
stm_set_char(lp1, 'D')
self.commit_transaction() # R2
assert last_commit_log_entries() == [lp1] # commit 'D'
- self.start_transaction()
- stm_set_char(lp1, 'd') # R2.1
+ if only_bk:
+ self.start_transaction()
+ stm_set_char(lp1, 'd') # R2.1
#
self.switch(3)
self.start_transaction() # stm_validate() -> R2
@@ -289,6 +292,55 @@
#
+ def test_read_write_16(self):
+ lp1 = stm_allocate_old(16) # allocated in seg0
+ lp2 = stm_allocate_old(16) # allocated in seg0
+ stm_get_real_address(lp1)[HDR] = 'a' #setchar
+ stm_get_real_address(lp2)[HDR] = 'b' #setchar
+ # S|P|P|P|P
+ #
+ # NO_ACCESS in all segments except seg0 (shared page holder)
+ #
+ # all seg at R0
+ #
+ self.start_transaction()
+ #
+ self.switch(1) # with private page
+ self.start_transaction()
+ stm_set_char(lp2, 'C')
+ self.commit_transaction() # R1
+ assert last_commit_log_entries() == [lp2] # commit 'C'
+ #
+ self.switch(2)
+ self.start_transaction()
+ stm_set_char(lp1, 'D')
+ self.commit_transaction() # R2
+ assert last_commit_log_entries() == [lp1] # commit 'D'
+ #
+ self.switch(3)
+ self.start_transaction() # stm_validate() -> R2
+ assert stm_get_char(lp1) == 'D' # R2
+ #
+ self.switch(2)
+ self.start_transaction()
+ stm_set_char(lp1, 'I')
+ self.commit_transaction() # R2
+ assert last_commit_log_entries() == [lp1] # commit 'I'
+ #
+ self.switch(1)
+ self.start_transaction()
+ stm_set_char(lp2, 'H')
+ self.commit_transaction() # R3
+ assert last_commit_log_entries() == [lp2] # commit 'H'
+ #
+ self.switch(3, validate=False) # R2 again
+ assert stm_get_char(lp1) == 'D' # R2
+ assert stm_get_char(lp2) == 'C' # R2
+ py.test.raises(Conflict, self.commit_transaction)
+ #
+
+
+
def test_commit_fresh_objects(self):
self.start_transaction()
lp = stm_allocate(16)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit