[pypy-commit] pypy stm-gc: A failing test
arigo
noreply at buildbot.pypy.org
Sat Apr 21 10:01:54 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc
Changeset: r54604:1772a9a9264a
Date: 2012-04-21 10:01 +0200
http://bitbucket.org/pypy/pypy/changeset/1772a9a9264a/
Log: A failing test
diff --git a/pypy/translator/c/test/test_standalone.py b/pypy/translator/c/test/test_standalone.py
--- a/pypy/translator/c/test/test_standalone.py
+++ b/pypy/translator/c/test/test_standalone.py
@@ -18,11 +18,14 @@
config = None
def compile(self, entry_point, debug=True, shared=False,
- stackcheck=False):
+ stackcheck=False, backendopt=False):
t = TranslationContext(self.config)
t.buildannotator().build_types(entry_point, [s_list_of_strings])
t.buildrtyper().specialize()
+ if backendopt:
+ all.backend_optimizations(t)
+
if stackcheck:
from pypy.translator.transform import insert_ll_stackcheck
insert_ll_stackcheck(t)
diff --git a/pypy/translator/stm/test/support.py b/pypy/translator/stm/test/support.py
--- a/pypy/translator/stm/test/support.py
+++ b/pypy/translator/stm/test/support.py
@@ -6,7 +6,7 @@
class CompiledSTMTests(StandaloneTests):
gc = "stmgc"
- def compile(self, entry_point):
+ def compile(self, entry_point, **kwds):
from pypy.config.pypyoption import get_pypy_config
self.config = get_pypy_config(translating=True)
self.config.translation.stm = True
@@ -17,7 +17,8 @@
from pypy.translator.backendopt.canraise import RaiseAnalyzer
RaiseAnalyzer.fail_on_unknown_operation = True
try:
- res = StandaloneTests.compile(self, entry_point, debug=True)
+ res = StandaloneTests.compile(self, entry_point, debug=True,
+ **kwds)
finally:
RaiseAnalyzer.fail_on_unknown_operation = False
return res
diff --git a/pypy/translator/stm/test/test_ztranslated.py b/pypy/translator/stm/test/test_ztranslated.py
--- a/pypy/translator/stm/test/test_ztranslated.py
+++ b/pypy/translator/stm/test/test_ztranslated.py
@@ -10,3 +10,40 @@
data, dataerr = cbuilder.cmdexec('4 5000', err=True)
assert 'done sleeping.' in dataerr
assert 'check ok!' in data
+
+ def test_bug1(self):
+ from pypy.rlib import rstm, rgc
+ from pypy.module.transaction import threadintf
+ #
+ class State:
+ pass
+ state = State()
+ #
+ def _foo(_, retry_counter):
+ rgc.collect(0)
+ def _run_thread():
+ rstm.descriptor_init()
+ rstm.perform_transaction(_foo, X, None)
+ threadintf.release(state.ll_unfinished_lock)
+ rstm.descriptor_done()
+ #
+ class X:
+ def __init__(self, count):
+ self.count = count
+ def g():
+ x = X(1000)
+ rstm.enter_transactional_mode()
+ threadintf.start_new_thread(_run_thread)
+ threadintf.acquire(state.ll_unfinished_lock, True)
+ rstm.leave_transactional_mode()
+ return x
+ def entry_point(argv):
+ state.ll_unfinished_lock = threadintf.allocate_lock()
+ x = X(len(argv))
+ y = g()
+ print '<', x.count, y.count, '>'
+ return 0
+ #
+ t, cbuilder = self.compile(entry_point, backendopt=True)
+ data = cbuilder.cmdexec('a b c d')
+ assert '< 5 1000 >' in data, "got: %r" % (data,)
More information about the pypy-commit
mailing list