[pypy-commit] pypy arm-backend-2: fix test_round_up_for_allocation for ARM

bivab noreply at buildbot.pypy.org
Fri Mar 9 18:27:58 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r53282:0a031fe30ed8
Date: 2012-03-09 17:26 +0000
http://bitbucket.org/pypy/pypy/changeset/0a031fe30ed8/

Log:	fix test_round_up_for_allocation for ARM

	ARM has stronger rules about aligned memory access that make this
	test behave differently

diff --git a/pypy/translator/c/test/test_lltyped.py b/pypy/translator/c/test/test_lltyped.py
--- a/pypy/translator/c/test/test_lltyped.py
+++ b/pypy/translator/c/test/test_lltyped.py
@@ -797,9 +797,11 @@
             assert res == 5
 
     def test_round_up_for_allocation(self):
+        import platform
         from pypy.rpython.lltypesystem import llmemory, llarena
         S = Struct('S', ('x', Char), ('y', Char))
         M = Struct('M', ('x', Char), ('y', Signed))
+        is_arm = platform.machine().startswith('arm')
         #
         def g():
             ssize = llarena.round_up_for_allocation(llmemory.sizeof(S))
@@ -813,7 +815,13 @@
         glob_sizes = g()
         #
         def check((ssize, msize, smsize, mssize)):
-            assert ssize == llmemory.sizeof(Signed)
+            if is_arm:
+                # ARM has stronger rules about aligned memory access
+                # so according to the rules for round_up_for_allocation
+                # we get two words here
+                assert ssize == llmemory.sizeof(Signed) * 2
+            else:
+                assert ssize == llmemory.sizeof(Signed)
             assert msize == llmemory.sizeof(Signed) * 2
             assert smsize == msize
             assert mssize == msize


More information about the pypy-commit mailing list