[pypy-commit] pypy stm: (arigo, antocuni): fix test_getarrayitem_all_sizes, and make sure we test both the cases of stm_getarrayitem inside and outside a transaction

antocuni noreply at buildbot.pypy.org
Mon Jan 16 16:31:00 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: stm
Changeset: r51347:08f6815aba37
Date: 2012-01-16 16:20 +0100
http://bitbucket.org/pypy/pypy/changeset/08f6815aba37/

Log:	(arigo, antocuni): fix test_getarrayitem_all_sizes, and make sure we
	test both the cases of stm_getarrayitem inside and outside a
	transaction

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
@@ -152,11 +152,12 @@
         array[i] = rffi.cast(lltype.typeOf(array).TO.OF, newvalues[i])
 change._annspecialcase_ = 'specialize:ll'
 
-def do_stm_getarrayitem(argv):
+def _play_with_getarrayitem(dummy_arg):
     check(prebuilt_array_signed, [1, 10, -1, -10, 42])
     check(prebuilt_array_char,   [chr(1), chr(10), chr(255),
                                   chr(246), chr(42)])
-    return 0
+    return NULL
+
 
 def do_stm_setarrayitem(argv):
     change(prebuilt_array_signed, [500000, -10000000, 3])
@@ -277,9 +278,23 @@
         cbuilder.cmdexec('')
 
     def test_getarrayitem_all_sizes(self):
+        def do_stm_getarrayitem(argv):
+            _play_with_getarrayitem(None)
+            return 0
         t, cbuilder = self.compile(do_stm_getarrayitem)
         cbuilder.cmdexec('')
 
+    def test_getarrayitem_all_sizes_inside_transaction(self):
+        def do_stm_getarrayitem(argv):
+            callback = llhelper(CALLBACK, _play_with_getarrayitem)
+            descriptor_init()
+            perform_transaction(callback, NULL)
+            descriptor_done()
+            return 0
+        t, cbuilder = self.compile(do_stm_getarrayitem)
+        cbuilder.cmdexec('')
+
+
     def test_setarrayitem_all_sizes(self):
         t, cbuilder = self.compile(do_stm_setarrayitem)
         cbuilder.cmdexec('')


More information about the pypy-commit mailing list