[pypy-commit] pypy release-2.3.x: fix test_pypy_c.test_struct on 32bit

bdkearns noreply at buildbot.pypy.org
Tue May 6 16:48:33 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: release-2.3.x
Changeset: r71333:1f92ec2eff46
Date: 2014-05-06 10:45 -0400
http://bitbucket.org/pypy/pypy/changeset/1f92ec2eff46/

Log:	fix test_pypy_c.test_struct on 32bit

diff --git a/pypy/module/pypyjit/test_pypy_c/test_struct.py b/pypy/module/pypyjit/test_pypy_c/test_struct.py
--- a/pypy/module/pypyjit/test_pypy_c/test_struct.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_struct.py
@@ -1,6 +1,18 @@
+import sys
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
 
+if sys.maxsize == 2 ** 63 - 1:
+    extra = """
+        i8 = int_ge(i4, -2147483648)
+        guard_true(i8, descr=...)
+        i9 = int_le(i4, 2147483647)
+        guard_true(i9, descr=...)
+    """
+else:
+    extra = ""
+
+
 class TestStruct(BaseTestPyPyC):
     def test_struct_function(self):
         def main(n):
@@ -20,10 +32,7 @@
         assert loop.match_by_id("struct", """
             guard_not_invalidated(descr=...)
             # struct.pack
-            i8 = int_ge(i4, -2147483648)
-            guard_true(i8, descr=...)
-            i9 = int_le(i4, 2147483647)
-            guard_true(i9, descr=...)
+            %s
             i11 = int_and(i4, 255)
             i13 = int_rshift(i4, 8)
             i14 = int_and(i13, 255)
@@ -41,7 +50,7 @@
             guard_false(i28, descr=...)
             i30 = int_lshift(i20, 24)
             i31 = int_or(i26, i30)
-        """)
+        """ % extra)
 
     def test_struct_object(self):
         def main(n):
@@ -60,10 +69,7 @@
         assert loop.match_by_id('struct', """
             guard_not_invalidated(descr=...)
             # struct.pack
-            i8 = int_ge(i4, -2147483648)
-            guard_true(i8, descr=...)
-            i9 = int_le(i4, 2147483647)
-            guard_true(i9, descr=...)
+            %s
             i11 = int_and(i4, 255)
             i13 = int_rshift(i4, 8)
             i14 = int_and(i13, 255)
@@ -81,4 +87,4 @@
             guard_false(i28, descr=...)
             i30 = int_lshift(i20, 24)
             i31 = int_or(i26, i30)
-        """)
+        """ % extra)


More information about the pypy-commit mailing list