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

pypy/module/pypyjit/test_pypy_c/test_thread.py::TestThread::()::test_simple

self = <pypy.module.pypyjit.test_pypy_c.test_thread.TestThread object at 0x000000000de0dd00>

    def test_simple(self):
        def main(n):
            try:
                import _thread as thread
            except ImportError:
                import thread
            def f():
                i = 0
                while i < n:
                    i += 1
                done.release()
    
            done = thread.allocate_lock()
            done.acquire()
            thread.start_new_thread(f, ())
            done.acquire()
            return 0
        log = self.run(main, [500])
        assert round(log.result, 6) == round(main(500), 6)
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match("""
                i2 = int_lt(i0, i1)
                guard_true(i2, descr=...)
                i3 = int_add(i0, 1)
                --THREAD-TICK--
                jump(..., descr=...)
            """)

pypy/module/pypyjit/test_pypy_c/test_thread.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypy/module/pypyjit/test_pypy_c/model.py:177: in match
    return matcher.match(expected_src, **kwds)
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 0x000000000d94f868>
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 = None
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:

	===== HERE =====
    guard_not_invalidated(descr=<Guard0x7fcf174d1b00>)
    i34 = int_lt(i26, i23)
    guard_true(i34, descr=<Guard0x7fcf137922c0>)
    i36 = int_add(i26, 1)
    i38 = getfield_raw_i(140527423261344, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i40 = int_add(i38, -1)
    setfield_raw(140527423261344, i40, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i43 = int_lt(i40, 0)
    guard_false(i43, descr=<Guard0x7fcf174d1b50>)
    jump(p0, p1, i36, p10, p12, p20, i23, descr=TargetToken(140527361655328))

Expected:
    
    i2 = int_lt(i0, i1)
    guard_true(i2, descr=...)
    i3 = int_add(i0, 1)
    
    guard_not_invalidated?
    ticker0 = getfield_raw_i(#, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
    ticker1 = int_add(ticker0, #)
    setfield_raw(#, ticker1, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
    ticker_cond0 = int_lt(ticker1, 0)
    guard_false(ticker_cond0, descr=...)
    
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_thread.py::TestThread::()::test_simple