[pypy-commit] stmgc default: Fix in the test: allow for other threads that want to abort us after
arigo
noreply at buildbot.pypy.org
Sat Jun 22 16:12:52 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r237:511679409ba9
Date: 2013-06-22 16:12 +0200
http://bitbucket.org/pypy/stmgc/changeset/511679409ba9/
Log: Fix in the test: allow for other threads that want to abort us after
a major gc.
diff --git a/c4/test/model.py b/c4/test/model.py
--- a/c4/test/model.py
+++ b/c4/test/model.py
@@ -167,6 +167,12 @@
assert self.previous is gs.most_recent_committed_revision
gs.most_recent_committed_revision = self
+ def check_can_still_commit(self):
+ gs = self.globalstate
+ saved = self.previous
+ self._extend_timestamp(gs.most_recent_committed_revision)
+ self.previous = saved
+
class GlobalState(object):
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
@@ -149,6 +149,20 @@
#
return x, y
+ def do_check_can_still_commit(self):
+ try:
+ self.current_rev.check_can_still_commit()
+ except (model.Deleted, model.Conflict), e:
+ # the model says that we might get an abort
+ self.dump('possible delayed abort!')
+ self.expected_abort()
+ lib.AbortNowIfDelayed()
+ # ok, it's fine if we don't actually get an abort
+ self.cancel_expected_abort()
+ else:
+ # the model says that we must not get an abort
+ lib.AbortNowIfDelayed()
+
def get_ref(self, r, index):
self.check(r)
if r == emptypair:
@@ -356,6 +370,7 @@
if do_wait:
self.push_roots(extra=p)
do_wait()
+ self.do_check_can_still_commit()
p = self.pop_roots(extra=p)
def run_single_thread(self):
@@ -452,7 +467,6 @@
self.toggle = not threadid
self.cond.notify()
lib.stm_start_sharedlock()
- lib.AbortNowIfDelayed()
def wait1(self):
self.wait(False)
@@ -506,6 +520,6 @@
test_multi_thread(1624)
def test_more_multi_thread():
- py.test.skip("more random tests")
+ #py.test.skip("more random tests")
for i in range(200):
yield test_multi_thread, 1624 + i
More information about the pypy-commit
mailing list