[pypy-commit] pypy default: import cffi/72b862bbb88e
arigo
pypy.commits at gmail.com
Wed Sep 20 03:37:25 EDT 2017
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r92422:8de1edd0e447
Date: 2017-09-20 09:36 +0200
http://bitbucket.org/pypy/pypy/changeset/8de1edd0e447/
Log: import cffi/72b862bbb88e
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py
@@ -2456,9 +2456,18 @@
pt = lib.call2(lib.cb2)
assert (pt.x, pt.y) == (99*500*999, -99*500*999)
+def _only_test_on_linux_intel():
+ if not sys.platform.startswith('linux'):
+ py.test.skip('only running the memory-intensive test on Linux')
+ import platform
+ machine = platform.machine()
+ if 'x86' not in machine and 'x64' not in machine:
+ py.test.skip('only running the memory-intensive test on x86/x64')
+
def test_ffi_gc_size_arg():
# with PyPy's GC, these calls to ffi.gc() would rapidly consume
# 40 GB of RAM without the third argument
+ _only_test_on_linux_intel()
ffi = FFI()
ffi.cdef("void *malloc(size_t); void free(void *);")
lib = ffi.verify(r"""
@@ -2467,8 +2476,8 @@
for i in range(2000):
p = lib.malloc(20*1024*1024) # 20 MB
p1 = ffi.cast("char *", p)
- for j in xrange(0, 20*1024*1024, 4096):
- p1[j] = '!'
+ for j in range(0, 20*1024*1024, 4096):
+ p1[j] = b'!'
p = ffi.gc(p, lib.free, 20*1024*1024)
del p
@@ -2478,6 +2487,7 @@
# is skipped on CPython, where it eats all the memory.
if '__pypy__' not in sys.builtin_module_names:
py.test.skip("find a way to tweak the cyclic GC of CPython")
+ _only_test_on_linux_intel()
ffi = FFI()
ffi.cdef("void *malloc(size_t); void free(void *);")
lib = ffi.verify(r"""
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/test_version.py
@@ -37,7 +37,7 @@
v = cffi.__version__.replace('+', '')
p = os.path.join(parent, 'doc', 'source', 'installation.rst')
content = open(p).read()
- assert ("cffi/cffi-%s.tar.gz" % v) in content
+ assert ("/cffi-%s.tar.gz" % v) in content
def test_setup_version():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py
--- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py
+++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_verify1.py
@@ -2295,7 +2295,16 @@
assert ffi.typeof("UINT_PTR") is ffi.typeof(expected)
assert ffi.typeof("PTSTR") is ffi.typeof("wchar_t *")
-def test_gc_pypy_size_arg():
+def _only_test_on_linux_intel():
+ if not sys.platform.startswith('linux'):
+ py.test.skip('only running the memory-intensive test on Linux')
+ import platform
+ machine = platform.machine()
+ if 'x86' not in machine and 'x64' not in machine:
+ py.test.skip('only running the memory-intensive test on x86/x64')
+
+def test_ffi_gc_size_arg():
+ _only_test_on_linux_intel()
ffi = FFI()
ffi.cdef("void *malloc(size_t); void free(void *);")
lib = ffi.verify(r"""
@@ -2304,8 +2313,8 @@
for i in range(2000):
p = lib.malloc(20*1024*1024) # 20 MB
p1 = ffi.cast("char *", p)
- for j in xrange(0, 20*1024*1024, 4096):
- p1[j] = '!'
+ for j in range(0, 20*1024*1024, 4096):
+ p1[j] = b'!'
p = ffi.gc(p, lib.free, 20*1024*1024)
del p
# with PyPy's GC, the above would rapidly consume 40 GB of RAM
@@ -2317,6 +2326,7 @@
# is skipped on CPython, where it eats all the memory.
if '__pypy__' not in sys.builtin_module_names:
py.test.skip("find a way to tweak the cyclic GC of CPython")
+ _only_test_on_linux_intel()
ffi = FFI()
ffi.cdef("void *malloc(size_t); void free(void *);")
lib = ffi.verify(r"""
More information about the pypy-commit
mailing list