New issue 2172: PPC test case failure: rpython/rlib/test/test_rmmap.py fails on 
PPC64LE machine
https://bitbucket.org/pypy/pypy/issues/2172/ppc-test-case-failure-rpython-rlib-test

Vaibhav Sood:

Ran the test on a Ubuntu 14.10 PPC64LE machine (same test passes on a Ubuntu 
14.10 x86-64 machine):

./pytest.py -rfExs rpython/rlib/test/test_rmmap.py

Get the following failure log (trace snipped to show only failure part):


```
#!python

rpython/rlib/test/test_rmmap.py:299:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _

fileno = 9, length = 6, flags = 1, prot = -3, access = 1, offset = 0

    def mmap(fileno, length, flags=MAP_SHARED,
             prot=PROT_WRITE | PROT_READ, access=_ACCESS_DEFAULT, offset=0):

        fd = fileno

        # check access is not there when flags and prot are there
        if access != _ACCESS_DEFAULT and ((flags != MAP_SHARED) or
                                          (prot != (PROT_WRITE | PROT_READ))):
            raise RValueError("mmap can't specify both access and flags, prot.")

        # check size boundaries
        _check_map_size(length)
        map_size = length
        if offset < 0:
            raise RValueError("negative offset")

        if access == ACCESS_READ:
            flags = MAP_SHARED
            prot = PROT_READ
        elif access == ACCESS_WRITE:
            flags = MAP_SHARED
            prot = PROT_READ | PROT_WRITE
        elif access == ACCESS_COPY:
            flags = MAP_PRIVATE
            prot = PROT_READ | PROT_WRITE
        elif access == _ACCESS_DEFAULT:
            # map prot to access type
            if prot & PROT_READ and prot & PROT_WRITE:
                pass  # _ACCESS_DEFAULT
            elif prot & PROT_WRITE:
                access = ACCESS_WRITE
            else:
                access = ACCESS_READ
        else:
            raise RValueError("mmap invalid access parameter.")

        # check file size
        try:
            st = os.fstat(fd)
        except OSError:
            pass     # ignore errors and trust map_size
        else:
            mode = st[stat.ST_MODE]
            size = st[stat.ST_SIZE]
            if stat.S_ISREG(mode):
                if map_size == 0:
                    if size == 0:
                        raise RValueError("cannot mmap an empty file")
                    if offset > size:
                        raise RValueError(
                            "mmap offset is greater than file size")
                    map_size = int(size - offset)
                    if map_size != size - offset:
                        raise RValueError("mmap length is too large")
                elif offset + map_size > size:
                    raise RValueError("mmap length is greater than file size")

        m = MMap(access, offset)
        if fd == -1:
            # Assume the caller wants to map anonymous memory.
            # This is the same behaviour as Windows.  mmap.mmap(-1, size)
            # on both Windows and Unix map anonymous memory.
            m.fd = -1

            flags |= MAP_ANONYMOUS

        else:
            m.fd = os.dup(fd)

        # XXX if we use hintp below in alloc, the NonConstant
        #     is necessary since we want a general version of c_mmap
        #     to be annotated with a non-constant pointer.
        res = c_mmap(NonConstant(NULL), map_size, prot, flags, fd, offset)
        if res == rffi.cast(PTR, -1):
            errno = rposix.get_saved_errno()
>           raise OSError(errno, os.strerror(errno))
E           OSError: [Errno 22] Invalid argument
```



_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to