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

translator/c/test/test_standalone.py::TestThread::()::test_stack_size

self = <rpython.translator.c.test.test_standalone.TestThread object at 0x000002b6e4d904f0>

    def test_stack_size(self):
        import time
        from rpython.rlib import rthread
        from rpython.rtyper.lltypesystem import lltype
    
        class State:
            pass
        state = State()
    
        def recurse(n):
            if n > 0:
                return recurse(n-1)+1
            else:
                time.sleep(0.2)      # invokes before/after
                return 0
    
        # recurse a lot
        RECURSION = 19500
        if sys.platform == 'win32':
            # If I understand it correctly:
            # - The stack size "reserved" for a new thread is a compile-time
            #   option (by default: 1Mb).  This is a minimum that user code
            #   cannot control.
            # - set_stacksize() only sets the initially "committed" size,
            #   which eventually requires a larger "reserved" size.
            # - The limit below is large enough to exceed the "reserved" size,
            #   for small values of set_stacksize().
            RECURSION = 150 * 1000
    
        def bootstrap():
            recurse(RECURSION)
            state.count += 1
    
        def entry_point(argv):
            os.write(1, "hello world\n")
            error = rthread.set_stacksize(int(argv[1]))
            if error != 0:
                os.write(2, "set_stacksize(%d) returned %d\n" % (
                    int(argv[1]), error))
                raise AssertionError
            # malloc a bit
            s1 = State(); s2 = State(); s3 = State()
            s1.x = 0x11111111; s2.x = 0x22222222; s3.x = 0x33333333
            # start 3 new threads
            state.count = 0
            ident1 = rthread.start_new_thread(bootstrap, ())
            ident2 = rthread.start_new_thread(bootstrap, ())
            ident3 = rthread.start_new_thread(bootstrap, ())
            # wait for the 3 threads to finish
            while True:
                if state.count == 3:
                    break
                time.sleep(0.1)      # invokes before/after
            # check that the malloced structures were not overwritten
            assert s1.x == 0x11111111
            assert s2.x == 0x22222222
            assert s3.x == 0x33333333
            os.write(1, "done\n")
            return 0
    
>       t, cbuilder = self.compile(entry_point)

translator\c\test\test_standalone.py:1350: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
translator\c\test\test_standalone.py:1285: in compile
    cbuilder.compile()
translator\c\genc.py:341: in compile
    extra_opts)
translator\platform\windows.py:574: in execute_makefile
    self._handle_error(returncode, stdout, stderr, path.join('make'))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <MsvcPlatform cc=cl.exe>, returncode = 2
stdout = '\tcl.exe stdafx.c /c /nologo /MD  /O2 -DPYPY_MAKEFILE /Ycstdafx.h /Fpstdafx.pch /FIstdafx.h /I/include  /I"D:\\a\\pyp...ython_memory_gc.c(2147): error C2037: left of \'ullTotalPhys\' specifies undefined struct/union \'MEMORYSTATUSEX\'\r\n'
stderr = '\tcl.exe stdafx.c /c /nologo /MD  /O2 -DPYPY_MAKEFILE /Ycstdafx.h /Fpstdafx.pch /FIstdafx.h /I/include  /I"D:\\a\\pyp...a\\pypy\\pypy\\rpython"\\translator\\c  /I"D:\\a\\pypy\\pypy\\rpython"\\rlib\\src\' : return code \'0x2\'\r\nStop.\r\n'
outname = local('c:\\users\\runner~1\\appdata\\local\\temp\\usession-pypy-HEAD-15\\testing_30\\make')

    def _handle_error(self, returncode, stdout, stderr, outname):
        if returncode != 0:
            # Microsoft compilers write compilation errors to stdout
            stderr = stdout + stderr
            errorfile = outname.new(ext='errors')
            errorfile.write(stderr, mode='wb')
            if self.log_errors:
                stderrlines = stderr.splitlines()
                for line in stderrlines:
                    log.Error(line)
                # ^^^ don't use ERROR, because it might actually be fine.
                # Also, ERROR confuses lib-python/conftest.py.
>           raise CompilationError(stdout, stderr)
E           CompilationError: CompilationError(err="""
E           		cl.exe stdafx.c /c /nologo /MD  /O2 -DPYPY_MAKEFILE /Ycstdafx.h /Fpstdafx.pch /FIstdafx.h /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	stdafx.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fotesting_30.obj /c testing_30.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	testing_30.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gc.obj /c data_rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_memory_gc.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gctransform.obj /c data_rpython_memory_gctransform.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_memory_gctransform.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rlib.obj /c data_rpython_rlib.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_rlib.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper.obj /c data_rpython_rtyper.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_rtyper.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper_lltypesystem.obj /c data_rpython_rtyper_lltypesystem.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_rtyper_lltypesystem.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_translator_c_test.obj /c data_rpython_translator_c_test.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_translator_c_test.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fononfuncnodes.obj /c nonfuncnodes.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	nonfuncnodes.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gc_1.obj /c data_rpython_memory_gc_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_memory_gc_1.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rlib_1.obj /c data_rpython_rlib_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_rlib_1.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper_lltypesystem_1.obj /c data_rpython_rtyper_lltypesystem_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	data_rpython_rtyper_lltypesystem_1.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Foimplement.obj /c implement.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	implement.c
E           	implement.c(233): warning C4133: 'function': incompatible types - from 'MEMORYSTATUSEX *' to 'LPMEMORYSTATUSEX'
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory.obj /c rpython_memory.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	rpython_memory.c
E           		cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory_gc.obj /c rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
E           	rpython_memory_gc.c
E           	rpython_memory_gc.c(2113): error C2027: use of undefined type 'MEMORYSTATUSEX'
E           	c:\Users\runneradmin\AppData\Local\Temp\usession-pypy-HEAD-15\testing_30\singleheader.h(2184): note: see declaration of 'MEMORYSTATUSEX'
E           	rpython_memory_gc.c(2139): error C2027: use of undefined type 'MEMORYSTATUSEX'
E           	c:\Users\runneradmin\AppData\Local\Temp\usession-pypy-HEAD-15\testing_30\singleheader.h(2184): note: see declaration of 'MEMORYSTATUSEX'
E           	rpython_memory_gc.c(2140): error C2037: left of 'dwLength' specifies undefined struct/union 'MEMORYSTATUSEX'
E           	rpython_memory_gc.c(2147): error C2037: left of 'ullTotalPhys' specifies undefined struct/union 'MEMORYSTATUSEX'
E           	NMAKE : fatal error U1077: 'cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory_gc.obj /c rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src' : return code '0x2'
E           	Stop.
E           	""")

translator\platform\windows.py:319: CompilationError
---------- Captured stderr call ----------
[platform:msg] Updated environment with vsver 160, using x64 True
[rtyper] specializing: 100 / 274 blocks   (36%)
[rtyper] specializing: 200 / 393 blocks   (50%)
[rtyper] specializing: 300 / 393 blocks   (76%)
[rtyper] -=- specialized 397 blocks -=-
[rtyper] specializing: 400 / 401 blocks   (99%)
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] -=- specialized 25 more blocks -=-
[rtyper] specializing: 500 / 2884 blocks   (17%)
[rtyper] specializing: 700 / 2965 blocks   (23%)
[rtyper] specializing: 1100 / 3722 blocks   (29%)
[rtyper] specializing: 1300 / 3726 blocks   (34%)
[rtyper] specializing: 1500 / 3836 blocks   (39%)
[rtyper] specializing: 1700 / 3836 blocks   (44%)
[rtyper] specializing: 1900 / 3836 blocks   (49%)
[rtyper] specializing: 2100 / 3848 blocks   (54%)
[rtyper] specializing: 2300 / 3848 blocks   (59%)
[rtyper] specializing: 2500 / 3848 blocks   (64%)
[rtyper] specializing: 2700 / 3850 blocks   (70%)
[rtyper] specializing: 2900 / 3850 blocks   (75%)
[rtyper] specializing: 3100 / 3850 blocks   (80%)
[rtyper] specializing: 3300 / 3850 blocks   (85%)
[rtyper] specializing: 3500 / 3850 blocks   (90%)
[rtyper] specializing: 3700 / 3850 blocks   (96%)
[rtyper] -=- specialized 3432 more blocks -=-
[rtyper] specializing: 3900 / 3968 blocks   (98%)
[rtyper] -=- specialized 110 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 1869 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 81 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] -=- specialized 21 more blocks -=-
[rtyper] specializing: 4000 / 4037 blocks   (99%)
[rtyper] -=- specialized 48 more blocks -=-
[rtyper] -=- specialized 0 more blocks -=-
[c:database] GC transformer: finished helpers
[rtyper] -=- specialized 62 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 4 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 16 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[c:database] GC transformer: finished tables
[gctransform:info] assigned 71 typeids
[gctransform:info] added 109 push/pop stack root instructions
[gctransform:info] inserted 11 write barrier calls
[gctransform:info] inserted 14 write_barrier_from_array calls
[gctransform:info] found 4 static roots
[c:database] Inlining GC helpers and postprocessing
[c]      883 nodes  [ array: 144  framework rtti: 22  func: 331  group: 1  struct: 385 ]
[c:database] Completed
[c:writing] structdef.h
[c:writing] forwarddecl.h
[c:writing] preimpl.h
[c:writing] data_rpython_memory_gc.c
[c:writing] data_rpython_memory_gctransform.c
[c:writing] data_rpython_rlib.c
[c:writing] data_rpython_rtyper.c
[c:writing] data_rpython_rtyper_lltypesystem.c
[c:writing] data_rpython_translator_c_test.c
[c:writing] nonfuncnodes.c
[c:writing] data_rpython_memory_gc_1.c
[c:writing] data_rpython_rlib_1.c
[c:writing] data_rpython_rtyper_lltypesystem_1.c
[c:writing] implement.c
[c:writing] rpython_memory.c
[c:writing] rpython_memory_gc.c
[c:writing] rpython_memory_gctransform.c
[c:writing] rpython_rlib.c
[c:writing] rpython_rtyper.c
[c:writing] rpython_rtyper_lltypesystem.c
[c:writing] rpython_translator.c
[c:writing] rpython_translator_c.c
[c:writing] rpython_translator_c_test.c
[platform:execute] nmake  in c:\users\runner~1\appdata\local\temp\usession-pypy-HEAD-15\testing_30
[platform:Error] 	cl.exe stdafx.c /c /nologo /MD  /O2 -DPYPY_MAKEFILE /Ycstdafx.h /Fpstdafx.pch /FIstdafx.h /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] stdafx.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fotesting_30.obj /c testing_30.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] testing_30.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gc.obj /c data_rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_memory_gc.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gctransform.obj /c data_rpython_memory_gctransform.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_memory_gctransform.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rlib.obj /c data_rpython_rlib.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_rlib.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper.obj /c data_rpython_rtyper.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_rtyper.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper_lltypesystem.obj /c data_rpython_rtyper_lltypesystem.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_rtyper_lltypesystem.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_translator_c_test.obj /c data_rpython_translator_c_test.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_translator_c_test.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fononfuncnodes.obj /c nonfuncnodes.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] nonfuncnodes.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_memory_gc_1.obj /c data_rpython_memory_gc_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_memory_gc_1.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rlib_1.obj /c data_rpython_rlib_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_rlib_1.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Fodata_rpython_rtyper_lltypesystem_1.obj /c data_rpython_rtyper_lltypesystem_1.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] data_rpython_rtyper_lltypesystem_1.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Foimplement.obj /c implement.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] implement.c
[platform:Error] implement.c(233): warning C4133: 'function': incompatible types - from 'MEMORYSTATUSEX *' to 'LPMEMORYSTATUSEX'
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory.obj /c rpython_memory.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] rpython_memory.c
[platform:Error] 	cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory_gc.obj /c rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src
[platform:Error] rpython_memory_gc.c
[platform:Error] rpython_memory_gc.c(2113): error C2027: use of undefined type 'MEMORYSTATUSEX'
[platform:Error] c:\Users\runneradmin\AppData\Local\Temp\usession-pypy-HEAD-15\testing_30\singleheader.h(2184): note: see declaration of 'MEMORYSTATUSEX'
[platform:Error] rpython_memory_gc.c(2139): error C2027: use of undefined type 'MEMORYSTATUSEX'
[platform:Error] c:\Users\runneradmin\AppData\Local\Temp\usession-pypy-HEAD-15\testing_30\singleheader.h(2184): note: see declaration of 'MEMORYSTATUSEX'
[platform:Error] rpython_memory_gc.c(2140): error C2037: left of 'dwLength' specifies undefined struct/union 'MEMORYSTATUSEX'
[platform:Error] rpython_memory_gc.c(2147): error C2037: left of 'ullTotalPhys' specifies undefined struct/union 'MEMORYSTATUSEX'
[platform:Error] NMAKE : fatal error U1077: 'cl.exe /nologo /MD  /O2 -DPYPY_MAKEFILE /Yustdafx.h /Fpstdafx.pch /FIstdafx.h /Forpython_memory_gc.obj /c rpython_memory_gc.c /I/include  /I"D:\a\pypy\pypy\rpython"\translator\c  /I"D:\a\pypy\pypy\rpython"\rlib\src' : return code '0x2'
[platform:Error] Stop.
builder: rpython-win-x86-64 build #765*
test: translator/c/test/test_standalone.py::TestThread::()::test_stack_size