Author: David Schneider <david.schnei...@picle.org> Branch: Changeset: r64894:8d3a39a0e619 Date: 2013-06-16 10:56 -0500 http://bitbucket.org/pypy/pypy/changeset/8d3a39a0e619/
Log: import tests from cffi diff --git a/pypy/module/test_lib_pypy/cffi_tests/test_ffi_backend.py b/pypy/module/test_lib_pypy/cffi_tests/test_ffi_backend.py --- a/pypy/module/test_lib_pypy/cffi_tests/test_ffi_backend.py +++ b/pypy/module/test_lib_pypy/cffi_tests/test_ffi_backend.py @@ -1,5 +1,6 @@ # Generated by pypy/tool/import_cffi.py -import py, sys +import py, sys, platform +import pytest from pypy.module.test_lib_pypy.cffi_tests import backend_tests, test_function, test_ownlib from cffi import FFI import _cffi_backend @@ -122,6 +123,7 @@ self.check("int a:2; short b:15; char c:2; char y;", 5, 4, 8) self.check("int a:2; char b:1; char c:1; char y;", 1, 4, 4) + @pytest.mark.skipif("platform.machine().startswith('arm')") def test_bitfield_anonymous_no_align(self): L = FFI().alignof("long long") self.check("char y; int :1;", 0, 1, 2) @@ -134,6 +136,20 @@ self.check("char x; long long z:57; char y;", L + 8, L, L + 8 + L) self.check("char x; long long :57; char y;", L + 8, 1, L + 9) + @pytest.mark.skipif("not platform.machine().startswith('arm')") + def test_bitfield_anonymous_align_arm(self): + L = FFI().alignof("long long") + self.check("char y; int :1;", 0, 4, 4) + self.check("char x; int z:1; char y;", 2, 4, 4) + self.check("char x; int :1; char y;", 2, 4, 4) + self.check("char x; long long z:48; char y;", 7, L, 8) + self.check("char x; long long :48; char y;", 7, 8, 8) + self.check("char x; long long z:56; char y;", 8, L, 8 + L) + self.check("char x; long long :56; char y;", 8, L, 8 + L) + self.check("char x; long long z:57; char y;", L + 8, L, L + 8 + L) + self.check("char x; long long :57; char y;", L + 8, L, L + 8 + L) + + @pytest.mark.skipif("platform.machine().startswith('arm')") def test_bitfield_zero(self): L = FFI().alignof("long long") self.check("char y; int :0;", 0, 1, 4) @@ -144,6 +160,17 @@ self.check("char x; int :0; short b:1; char y;", 5, 2, 6) self.check("int a:1; int :0; int b:1; char y;", 5, 4, 8) + @pytest.mark.skipif("not platform.machine().startswith('arm')") + def test_bitfield_zero_arm(self): + L = FFI().alignof("long long") + self.check("char y; int :0;", 0, 4, 4) + self.check("char x; int :0; char y;", 4, 4, 8) + self.check("char x; int :0; int :0; char y;", 4, 4, 8) + self.check("char x; long long :0; char y;", L, 8, L + 8) + self.check("short x, y; int :0; int :0;", 2, 4, 4) + self.check("char x; int :0; short b:1; char y;", 5, 4, 8) + self.check("int a:1; int :0; int b:1; char y;", 5, 4, 8) + def test_error_cases(self): ffi = FFI() py.test.raises(TypeError, _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit