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

jit/backend/aarch64/test/test_runner.py::TestARM64::()::test_call_release_gil_save_errno

self = <rpython.jit.backend.aarch64.test.test_runner.TestARM64 object at 0x0000000141fdfde0>

    def test_call_release_gil_save_errno(self):
        from rpython.translator.tool.cbuild import ExternalCompilationInfo
        from rpython.rlib.libffi import types
        from rpython.jit.backend.llsupport import llerrno
        #
        if not isinstance(self.cpu, AbstractLLCPU):
            py.test.skip("not on LLGraph")
        eci = ExternalCompilationInfo(
            separate_module_sources=['''
                    #include <errno.h>
                    static Signed f1(Signed a, Signed b, Signed c, Signed d,
                                     Signed e, Signed f, Signed g) {
                        errno = 42;
                        return (a + 10*b + 100*c + 1000*d +
                                10000*e + 100000*f + 1000000*g);
                    }
                    RPY_EXPORTED
                    Signed test_call_release_gil_save_errno(void) {
                        return (Signed)&f1;
                    }
                '''])
        fn_name = 'test_call_release_gil_save_errno'
        getter_ptr = rffi.llexternal(fn_name, [], lltype.Signed,
                                     compilation_info=eci, _nowrapper=True)
        func1_adr = getter_ptr()
        calldescr = self.cpu._calldescr_dynamic_for_tests([types.signed]*7,
                                                          types.signed)
        #
        for saveerr in [rffi.RFFI_ERR_NONE,
                        rffi.RFFI_SAVE_ERRNO,
                        rffi.RFFI_ERR_NONE | rffi.RFFI_ALT_ERRNO,
                        rffi.RFFI_SAVE_ERRNO | rffi.RFFI_ALT_ERRNO,
                        ]:
            faildescr = BasicFailDescr(1)
            inputargs = [InputArgInt() for i in range(7)]
            op0 = ResOperation(rop.CALL_RELEASE_GIL_I,
                             [ConstInt(saveerr), ConstInt(func1_adr)]
                                 + inputargs,
                             descr=calldescr)
    
            ops = [
                op0,
                ResOperation(rop.GUARD_NOT_FORCED, [], descr=faildescr),
                ResOperation(rop.FINISH, [op0], descr=BasicFinalDescr(0))
            ]
            ops[-2].setfailargs([])
            looptoken = JitCellToken()
            self.cpu.compile_loop(inputargs, ops, looptoken)
            #
            llerrno.set_debug_saved_errno(self.cpu, 24)
            llerrno.set_debug_saved_alterrno(self.cpu, 25)
            deadframe = self.cpu.execute_token(looptoken, 9, 8, 7, 6, 5, 4, 3)
            original_result = self.cpu.get_int_value(deadframe, 0)
            result = llerrno.get_debug_saved_errno(self.cpu)
            altresult = llerrno.get_debug_saved_alterrno(self.cpu)
            print('saveerr =', saveerr, ': got result =', result,
                  'altresult =', altresult)
            #
            expected = {
                rffi.RFFI_ERR_NONE: (24, 25),
                rffi.RFFI_SAVE_ERRNO: (42, 25),
                rffi.RFFI_ERR_NONE | rffi.RFFI_ALT_ERRNO: (24, 25),
                rffi.RFFI_SAVE_ERRNO | rffi.RFFI_ALT_ERRNO: (24, 42),
            }
            # expected (24, 25) as originally set, with possibly one
            # of the two changed to 42 by the assembler code
>           assert (result, altresult) == expected[saveerr]
E           assert (7851111156646150186, 25) == (42, 25)
E             At index 0 diff: 7851111156646150186 != 42
E             Use -v to get the full diff

jit/backend/test/runner_test.py:3193: AssertionError
---------- Captured stdout call ----------
saveerr = 0 : got result = 24 altresult = 25
saveerr = 1 : got result = 7851111156646150186 altresult = 25
builder: rpython-macos-arm64 build #268+
test: jit/backend/aarch64/test/test_runner.py::TestARM64::()::test_call_release_gil_save_errno