[pypy-dev] Failing App-Level-Test test_posix2.py

Juergen Boemmels boemmels at web.de
Wed Aug 31 09:54:13 CEST 2011


Hi,

Since some weeks in one Applevel-test is failing consitently on the
buildbot:
module/posix/test/test_posix2.py
with the failure:
        if sys.platform.startswith('linux'):
>           assert hasattr(st, 'st_rdev')
E           assert hasattr(posix.stat_result(st_mode=33152,st_ino=1588275L, st_dev=64256L, st_nlink=1,s...integer_atime=1314759734, _integer_mtime=1314759734,_integer_ctime=1314759734), 'st_rdev')
module/posix/test/test_posix2.py:135: AssertionError ================ 1 failed, 77 passed, 6 skipped in 4.80 seconds ================
So it seems that st_rdev is not available

I tracked this problem down to a chicken-egg problem. The relevant
portion is here in
pypy/rpython/module/ll_os_stat.py:
# for now, check the host Python to know which st_xxx fields exist
STAT_FIELDS = [(_name, _TYPE) for (_name, _TYPE) in ALL_STAT_FIELDS
                              if hasattr(os.stat_result, _name)]

As pypy is meanwhile build with pypy, relying on the host python
is not a good idea. A pypy without st_rdev will again build only
a new pypy without st_rdev, even if the platform supports st_rdev.

As an experiment I bootstrapped pypy again with python an the
error disappered
# python translate.py -O2 targetpypystandalone.py
# ./pypy-c ../../../pytest.py ../../module/posix/test/test_posix2.py -A
========================= test session starts ==========================
platform linux2 -- Python 2.7.1[pypy-1.6.0] -- pytest-2.1.0.dev4
pytest-2.1.0.dev4 from /home/boemmels/src/pypy/pytest.pyc
collected 80 items

../../module/posix/test/test_posix2.py
...........................................................s............
........

================= 79 passed, 1 skipped in 5.07 seconds =================
This bootstrapped pypy-c is also cappable of rebuilding an pypy with
st_rdev enabled. But this is not a clean solution.

I think the way to go is to no longer rely on the Host-Python, but
use the appropiate configure magic. Something like
#ifdef HAVE_STRUCT_STAT_ST_RDEV
but in a pythonic way. Unfortunatly I'm not familar with pypy's
configuration system so I got stuck here.

Can anybody tell me how to test for available struct members like
AC_CHECK_MEMBERS([struct stat.st_rdev]) in autoconf?


Regards
juergen
___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar


More information about the pypy-dev mailing list