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

translator/c/test/test_genc.py::test_long_strings

def test_long_strings():
        s1 = 'hello'
        s2 = ''.join([chr(i) for i in range(256)])
        s3 = 'abcd'*17
        s4 = open(__file__, 'rb').read(2049)
        choices = [s1, s2, s3, s4]
        def f(i, j):
            return choices[i][j]
        f1 = compile(f, [int, int])
        for i, s in enumerate(choices):
            j = 0
            while j < len(s):
                c = s[j]
>               assert f1(i, j) == c

translator\c\test\test_genc.py:471: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
translator\c\test\test_genc.py:198: in __call__
    return f(*args, **kwds)
translator\c\test\test_genc.py:145: in f
    err=return_stderr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <rpython.translator.c.genc.CStandaloneBuilder object at 0x000001f4af05f6e0>
args = '1 57', env = None, err = False, expect_crash = False
exe = local('d:\\systemtemp\\pytest\\usession-pytest3.10-500\\testing_17\\testing_17.exe')

    def cmdexec(self, args='', env=None, err=False, expect_crash=False, exe=None):
        assert self._compiled
        if sys.platform == 'win32':
            #Prevent opening a dialog box
            import ctypes
            winapi = ctypes.windll.kernel32
            SetErrorMode = winapi.SetErrorMode
            SetErrorMode.argtypes=[ctypes.c_int]
    
            SEM_FAILCRITICALERRORS = 1
            SEM_NOGPFAULTERRORBOX  = 2
            SEM_NOOPENFILEERRORBOX = 0x8000
            flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX \
                    | SEM_NOOPENFILEERRORBOX
            #Since there is no GetErrorMode, do a double Set
            old_mode = SetErrorMode(flags)
            SetErrorMode(old_mode | flags)
        if env is None:
            envrepr = ''
        else:
            envrepr = ' [env=%r]' % (env,)
            env.update(os.environ)
        if exe is None:
            exe = self.executable_name
        log.cmdexec('%s %s%s' % (exe, args, envrepr))
        res = self.translator.platform.execute(exe, args, env=env)
        if sys.platform == 'win32':
            SetErrorMode(old_mode)
        if res.returncode != 0:
            if expect_crash:
                if type(expect_crash) is int and expect_crash != res.returncode:
                    raise Exception("Returned %d, but expected %d" % (
                        res.returncode, expect_crash))
                return res.out, res.err
            print(res.err, file=sys.stderr)
>           raise Exception("Returned %d" % (res.returncode,))
E           Exception: Returned 3221225477

translator\c\genc.py:318: Exception
builder: rpython-win-x86-64 build #404
test: translator/c/test/test_genc/py/test_long_strings