[pypy-commit] pypy s390x-backend: modified 2 tests, first used void pointer instead of int pointer (thus qsort did not sort),

plan_rich pypy.commits at gmail.com
Mon Jan 18 09:23:25 EST 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r81835:58481ef6fdd3
Date: 2016-01-18 15:22 +0100
http://bitbucket.org/pypy/pypy/changeset/58481ef6fdd3/

Log:	modified 2 tests, first used void pointer instead of int pointer
	(thus qsort did not sort), the second writes to a union but on a 64
	bit big endian machine this byte ends up in the MSB of the result
	instead of the LSB

diff --git a/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py b/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/test/test_ll2ctypes.py
@@ -945,6 +945,11 @@
         a[4] = rffi.r_int(4)
 
         def compare(a, b):
+            # do not use a,b directly! on a big endian machine
+            # ((void*)ptr)[0] will return 0x0 if the 32 bit value
+            # ptr points to is 0x1
+            a = rffi.cast(rffi.INTP, a)
+            b = rffi.cast(rffi.INTP, b)
             if a[0] > b[0]:
                 return rffi.r_int(1)
             else:
diff --git a/rpython/translator/c/test/test_lltyped.py b/rpython/translator/c/test/test_lltyped.py
--- a/rpython/translator/c/test/test_lltyped.py
+++ b/rpython/translator/c/test/test_lltyped.py
@@ -236,7 +236,9 @@
 
         fn = self.getcompiled(llf, [int])
         res = fn(0x33)
-        assert res in [0x10203033, 0x33203040]
+        assert res in [0x10203033, 0x33203040,
+                       # big endian 64 bit machine
+                       0x3300000010203040]
 
     def test_sizeof_void_array(self):
         from rpython.rtyper.lltypesystem import llmemory


More information about the pypy-commit mailing list