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

pypy/module/pypyjit/test_pypy_c/test_struct.py::TestStruct::()::test_struct_object

self = <pypy.module.pypyjit.test_pypy_c.test_struct.TestStruct object at 0x000000000b44ed78>

    def test_struct_object(self):
        def main(n):
            import struct
            s = struct.Struct("ii")
            i = 1
            while i < n:
                buf = s.pack(-1, i)     # ID: pack
                x = s.unpack(buf)[1]    # ID: unpack
                i += x // i
            return i
    
        log = self.run(main, [1000])
        assert log.result == main(1000)
    
        if sys.byteorder == 'little':
            loop, = log.loops_by_filename(self.filepath)
            assert loop.match_by_id('pack', """
                    dummy_get_utf8?
                    guard_not_invalidated(descr=...)
                    # struct.pack
                    p85 = newstr(8)
                    gc_store_indexed(p85, 0, -1, 1, _, 4, descr=...)
                    %s
                    gc_store_indexed(p85, 4, _, 1, _, 4, descr=...)
>               """ % extra)

pypy/module/pypyjit/test_pypy_c/test_struct.py:108: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypy/module/pypyjit/test_pypy_c/model.py:182: in match_by_id
    return matcher.match(expected_src, ignore_ops=ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:524: in match
    self.match_loop(expected_ops, ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:500: in match_loop
    self.match_op(op, exp_op)
pypy/module/pypyjit/test_pypy_c/model.py:409: in match_op
    self._assert(op.name == exp_opname, "operation mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x000000000bdd08a8>
cond = False, message = 'operation mismatch'

    def _assert(self, cond, message):
        if not cond:
>           raise InvalidMatch(message, frame=sys._getframe(1))
E           InvalidMatch: operation mismatch

pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = 'pack'
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:

	===== HERE =====
    p81 = newstr(8)
    gc_store_indexed(p81, 0, -1, 1, 24, 4, descr=<ArrayS 4>)
    i88 = int_ge(i74, -2147483648)
    guard_true(i88, descr=<Guard0x7f33b69a6ca0>)
    i90 = int_le(i74, 2147483647)
    guard_true(i90, descr=<Guard0x7f33b69ad4b0>)
    gc_store_indexed(p81, 4, i74, 1, 24, 4, descr=<ArrayS 4>)

Expected:
    
    dummy_get_utf8?
    guard_not_invalidated(descr=...)
    # struct.pack
    p85 = newstr(8)
    gc_store_indexed(p85, 0, -1, 1, _, 4, descr=...)
    
            i8 = int_ge(i4, -2147483648)
            guard_true(i8, descr=...)
            i9 = int_le(i4, 2147483647)
            guard_true(i9, descr=...)
    
                    gc_store_indexed(p85, 4, _, 1, _, 4, descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_struct.py::TestStruct::()::test_struct_object