[pypy-commit] pypy stm: (antocuni, arigo)

arigo noreply at buildbot.pypy.org
Mon Jan 16 18:19:04 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm
Changeset: r51359:e2645247a9c2
Date: 2012-01-16 18:18 +0100
http://bitbucket.org/pypy/pypy/changeset/e2645247a9c2/

Log:	(antocuni, arigo) Move CompiledSTMTests to its own file in
	translator/stm/test/support.py.

diff --git a/pypy/rlib/test/test_rstm.py b/pypy/rlib/test/test_rstm.py
--- a/pypy/rlib/test/test_rstm.py
+++ b/pypy/rlib/test/test_rstm.py
@@ -1,6 +1,6 @@
 from pypy.rlib.debug import debug_print
 from pypy.rlib import rstm
-from pypy.translator.c.test.test_standalone import StandaloneTests
+from pypy.translator.stm.test.support import CompiledSTMTests
 
 def test_stm_perform_transaction():
     class Arg(object):
@@ -16,26 +16,6 @@
     assert arg.x == 42
 
 
-class CompiledSTMTests(StandaloneTests):
-    gc = "none"
-
-    def compile(self, entry_point):
-        from pypy.config.pypyoption import get_pypy_config
-        self.config = get_pypy_config(translating=True)
-        self.config.translation.stm = True
-        self.config.translation.gc = self.gc
-        #
-        # Prevent the RaiseAnalyzer from just emitting "WARNING: Unknown
-        # operation".  We want instead it to crash.
-        from pypy.translator.backendopt.canraise import RaiseAnalyzer
-        RaiseAnalyzer.fail_on_unknown_operation = True
-        try:
-            res = StandaloneTests.compile(self, entry_point, debug=True)
-        finally:
-            RaiseAnalyzer.fail_on_unknown_operation = False
-        return res
-
-
 class TestTransformSingleThread(CompiledSTMTests):
 
     def test_no_pointer_operations(self):
diff --git a/pypy/translator/stm/test/support.py b/pypy/translator/stm/test/support.py
new file mode 100644
--- /dev/null
+++ b/pypy/translator/stm/test/support.py
@@ -0,0 +1,23 @@
+"""CompiledSTMTests, a support class for translated tests with STM"""
+
+from pypy.translator.c.test.test_standalone import StandaloneTests
+
+
+class CompiledSTMTests(StandaloneTests):
+    gc = "none"
+
+    def compile(self, entry_point):
+        from pypy.config.pypyoption import get_pypy_config
+        self.config = get_pypy_config(translating=True)
+        self.config.translation.stm = True
+        self.config.translation.gc = self.gc
+        #
+        # Prevent the RaiseAnalyzer from just emitting "WARNING: Unknown
+        # operation".  We want instead it to crash.
+        from pypy.translator.backendopt.canraise import RaiseAnalyzer
+        RaiseAnalyzer.fail_on_unknown_operation = True
+        try:
+            res = StandaloneTests.compile(self, entry_point, debug=True)
+        finally:
+            RaiseAnalyzer.fail_on_unknown_operation = False
+        return res
diff --git a/pypy/translator/stm/test/test_funcgen.py b/pypy/translator/stm/test/test_funcgen.py
--- a/pypy/translator/stm/test/test_funcgen.py
+++ b/pypy/translator/stm/test/test_funcgen.py
@@ -1,7 +1,6 @@
 from pypy.rpython.lltypesystem import lltype, rffi
 from pypy.rlib.rarithmetic import r_longlong, r_singlefloat
-from pypy.rlib.test.test_rstm import CompiledSTMTests
-#from pypy.rlib import rstm
+from pypy.translator.stm.test.support import CompiledSTMTests
 from pypy.translator.stm._rffi_stm import (CALLBACK, stm_perform_transaction,
                                            stm_descriptor_init, stm_descriptor_done)
 from pypy.translator.c.test.test_standalone import StandaloneTests
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
@@ -1,5 +1,5 @@
 import py
-from pypy.rlib.test.test_rstm import CompiledSTMTests
+from pypy.translator.stm.test.support import CompiledSTMTests
 from pypy.translator.stm.test import targetdemo
 
 


More information about the pypy-commit mailing list