[pypy-commit] pypy default: test fixes

plan_rich pypy.commits at gmail.com
Mon Nov 7 04:31:24 EST 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: 
Changeset: r88165:c43d1c913296
Date: 2016-11-07 10:29 +0100
http://bitbucket.org/pypy/pypy/changeset/c43d1c913296/

Log:	test fixes

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_costmodel.py b/rpython/jit/metainterp/optimizeopt/test/test_costmodel.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_costmodel.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_costmodel.py
@@ -172,16 +172,20 @@
         assert savings == 6
 
     def test_load_arith_store(self):
+        import platform
+        size = 4
+        if not platform.machine().startswith('x86'):
+            size = 8
         loop1 = self.parse_trace("""
         f10 = raw_load_f(p0, i0, descr=double)
         f11 = raw_load_f(p0, i1, descr=double)
         i20 = cast_float_to_int(f10)
         i21 = cast_float_to_int(f11)
-        i30 = int_signext(i20, 4)
-        i31 = int_signext(i21, 4)
+        i30 = int_signext(i20, {size})
+        i31 = int_signext(i21, {size})
         raw_store(p0, i3, i30, descr=int)
         raw_store(p0, i4, i31, descr=int)
-        """)
+        """.format(size=size))
         savings = self.savings(loop1)
         assert savings >= 0
 
@@ -195,7 +199,7 @@
         savings = self.savings(loop1)
         assert savings == 2
 
-    @py.test.mark.parametrize("bytes,s", [(1,0),(2,0),(4,0),(8,0)])
+    @py.test.mark.parametrize("bytes,s", [(4,0),(8,0)])
     def test_sum_float_to_int(self, bytes, s):
         loop1 = self.parse_trace("""
         f10 = raw_load_f(p0, i0, descr=double)
@@ -254,7 +258,7 @@
         except NotAProfitableLoop:
             pass
 
-    def test_force_long_to_int_cast(self):
+    def test_force_int_to_float_cast(self):
         trace = self.parse_trace("""
         i10 = raw_load_i(p0, i1, descr=long)
         i11 = raw_load_i(p0, i2, descr=long)
@@ -262,7 +266,7 @@
         f11 = cast_int_to_float(i11)
         """)
         number = self.savings(trace)
-        assert number == 1
+        assert number >= 1
 
 
 class Test(CostModelBaseTest, LLtypeMixin):
diff --git a/rpython/jit/metainterp/test/test_resoperation.py b/rpython/jit/metainterp/test/test_resoperation.py
--- a/rpython/jit/metainterp/test/test_resoperation.py
+++ b/rpython/jit/metainterp/test/test_resoperation.py
@@ -1,5 +1,6 @@
 import py
 import pytest
+import platform
 import re
 import sys
 from rpython.jit.metainterp import resoperation as rop
@@ -92,12 +93,15 @@
 
 VARI = rop.InputArgInt()
 VARF = rop.InputArgFloat()
- at py.test.mark.parametrize('opnum,args,kwargs', 
-    [ (rop.rop.INT_SIGNEXT, [VARI, ConstInt(2)], {'from': INT_WORD, 'to': 2, 'cast_to': ('i', 2) }),
-      (rop.rop.CAST_FLOAT_TO_INT, [VARF], {'from': 8, 'to': 4}),
-      (rop.rop.CAST_SINGLEFLOAT_TO_FLOAT, [VARI], {'from': 4, 'to': 8}),
-      (rop.rop.CAST_FLOAT_TO_SINGLEFLOAT, [VARF], {'from': 8, 'to': 4}),
-    ])
+args = [ (rop.rop.INT_SIGNEXT, [VARI, ConstInt(2)], {'from': INT_WORD, 'to': 2, 'cast_to': ('i', 2) }),
+         (rop.rop.CAST_FLOAT_TO_INT, [VARF], {'from': 8, 'to': 4}),
+         (rop.rop.CAST_SINGLEFLOAT_TO_FLOAT, [VARI], {'from': 4, 'to': 8}),
+         (rop.rop.CAST_FLOAT_TO_SINGLEFLOAT, [VARF], {'from': 8, 'to': 4}),
+        ]
+if not platform.machine().startswith('x86'):
+    del args[1]
+    args.append((rop.rop.CAST_FLOAT_TO_INT, [VARF], {'from': 8, 'to': 8}))
+ at py.test.mark.parametrize('opnum,args,kwargs', args)
 @pytest.mark.skipif("sys.maxint == 2**31-1")
 def test_cast_ops(opnum, args, kwargs):
     op = rop.ResOperation(opnum, args)
@@ -106,6 +110,7 @@
     assert op.cast_to_bytesize() == kwargs['to']
     if 'cast_to' in kwargs:
         assert op.cast_to() == kwargs['cast_to']
+del args
 
 def test_unpack_1():
     op = rop.ResOperation(rop.rop.VEC_UNPACK_I,


More information about the pypy-commit mailing list