Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r147:891faa27d62d
Date: 2013-06-16 13:02 +0200
http://bitbucket.org/pypy/stmgc/changeset/891faa27d62d/

Log:    Fix the test.

diff --git a/c4/test/test_random.py b/c4/test/test_random.py
--- a/c4/test/test_random.py
+++ b/c4/test/test_random.py
@@ -41,6 +41,7 @@
         self.sync_wait = sync_wait
         self.counter = 0
         self.current_rev = None
+        self.awaiting_abort = False
         #self.expecting_gap_in_commit_time = 2
         self.dump('run')
         #
@@ -100,7 +101,7 @@
         self.current_rev = None
 
     def cancel_expected_abort(self):
-        lib.stm_set_max_aborts(0)
+        lib.stm_set_max_aborts(int(self.awaiting_abort))
         self.expected_conflict = False
         self.current_rev = self.aborted_rev
         del self.aborted_rev
@@ -248,6 +249,16 @@
                 if q not in seen:
                     lst.append(q)
                     seen.add(q)
+
+            if self.is_private(ptr) and (p.obj.created_in_revision is not
+                                         self.current_rev):
+                try:
+                    self.current_rev.check_not_outdated(p.obj)
+                except model.Deleted:
+                    self.dump('POTENTIAL ABORT: %s' % (p,))
+                    self.awaiting_abort = True
+                    lib.stm_set_max_aborts(1)
+
         #self.dump('ok')
 
     def transaction_break(self):
@@ -273,9 +284,12 @@
         #
         if retry_counter == 0:
             assert not self.expected_conflict
+            assert not self.awaiting_abort
         else:
-            assert self.expected_conflict
+            assert self.expected_conflict or self.awaiting_abort
             self.expected_conflict = False
+            if self.awaiting_abort: self.current_rev = None
+            self.awaiting_abort = False
         #
         self.roots = self.roots_outside_perform[:]
         self.startrev()
@@ -330,6 +344,8 @@
 
     def commit(self):
         assert self.current_rev.start_time == lib.get_start_time()
+        if self.awaiting_abort:
+            raise model.Conflict("awaiting abort")
         self.current_rev.commit_transaction()
         self.current_rev = None
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to