Home - Summaries: (main) : (py3.11) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

rlib/test/test_rmmap.py::TestMMap::()::test_unmap_range

self = <rpython.rlib.test.test_rmmap.TestMMap instance at 0xfffe208597d0>

    @pytest.mark.skipif("os.name != 'posix'")
    def test_unmap_range(self):
        f = open(self.tmpname + "-unmap-range", "w+")
        left, right, size = 100, 200, 500  # in pages
    
        f.write(size*4096*"c")
        f.flush()
    
        def func(no):
            m = mmap.mmap(no, size*4096)
            m.unmap_range(left*4096, (right-left)*4096)
            m.read(1)
            m.seek(right*4096)
            m.read(1)
    
            def in_map(m, offset):
                return rffi.ptradd(m.data, offset)
            def as_num(ptr):
                return rffi.cast(lltype.Unsigned, ptr)
            res = mmap.alloc_hinted(in_map(m, (left+right)/2 * 4096), 4096)
            assert as_num(in_map(m, left*4096)) <= as_num(res) < as_num(in_map(m, right*4096))
>       interpret(func, [f.fileno()])

rlib/test/test_rmmap.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtyper/test/test_llinterp.py:102: in interpret
    result = interp.eval_graph(graph, values)
rtyper/llinterp.py:97: in eval_graph
    retval = llframe.eval()
rtyper/llinterp.py:295: in eval
    nextblock, args = self.eval_block(nextblock)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <rpython.rtyper.llinterp.LLFrame object at 0xfffe20a2eb90>
block = raise block[etype_0...] with 0 exits

    def eval_block(self, block):
        """ return (nextblock, values) tuple. If nextblock
                is None, values is the concrete return value.
            """
        self.curr_block = block
        e = None
    
        try:
            for i, op in enumerate(block.operations):
                self.curr_operation_index = i
                self.eval_operation(op)
        except LLException as e:
            if op is not block.raising_op:
                raise
        except RuntimeError as e:
            rstackovf.check_stack_overflow()
            # xxx fish fish fish for proper etype and evalue to use
            rtyper = self.llinterpreter.typer
            bk = rtyper.annotator.bookkeeper
            classdef = bk.getuniqueclassdef(rstackovf._StackOverflow)
            exdata = rtyper.exceptiondata
            evalue = exdata.get_standard_ll_exc_instance(rtyper, classdef)
            etype = exdata.fn_type_of_exc_inst(evalue)
            e = LLException(etype, evalue)
            if op is not block.raising_op:
                raise e
    
        # determine nextblock and/or return value
        if len(block.exits) == 0:
            # return block
            tracer = self.llinterpreter.tracer
            if len(block.inputargs) == 2:
                # exception
                if tracer:
                    tracer.dump('raise')
                etypevar, evaluevar = block.getvariables()
                etype = self.getval(etypevar)
                evalue = self.getval(evaluevar)
                # watch out, these are _ptr's
>               raise LLException(etype, evalue)
E               LLException: <LLException 'AssertionError'>

rtyper/llinterp.py:348: LLException
---------- Captured stderr call ----------
[rtyper] specializing: 100 / 369 blocks   (27%)
[rtyper] specializing: 200 / 428 blocks   (46%)
[rtyper] specializing: 300 / 430 blocks   (69%)
[rtyper] specializing: 400 / 430 blocks   (93%)
[rtyper] -=- specialized 430 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
builder: rpython-linux-aarch64 build #534
test: rlib/test/test_rmmap/py/TestMMap/()/test_unmap_range