[pypy-issue] [issue1643] cffi test_read_variable assumes glibc

Tobias Oberstein tracker at bugs.pypy.org
Mon Nov 18 14:40:02 CET 2013


New submission from Tobias Oberstein <tobias.oberstein at gmail.com>:

>From pypy/module/_cffi_backend/test/_backend_test_c.py:

def test_read_variable_as_unknown_length_array():
    if sys.platform == 'win32' or sys.platform == 'darwin':
        py.test.skip("untested")
    BCharP = new_pointer_type(new_primitive_type("char"))
    BArray = new_array_type(BCharP, None)
    ll = find_and_load_library('c')
    stderr = ll.read_variable(BArray, "stderr")
    assert repr(stderr).startswith("<cdata 'char *' 0x")

This assumes "stderr" is a variable thingy, which is only the case on glibc, but
non-standard.

It breaks on *BSDs where stdin, stdout, and stderr are macros that you cannot
use like a variable.

So skipping this test is not quite right even for "darwin". The test is just
wrong. It tests glibc specific behavior, not standard C library behavior.

----------
messages: 6364
nosy: oberstet, pypy-issue
priority: bug
status: unread
title: cffi test_read_variable assumes glibc

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1643>
________________________________________


More information about the pypy-issue mailing list