translator/c/test/test_boehm.py::TestUsingBoehm::()::test_finalizer_queue
self = <rpython.translator.c.test.test_boehm.TestUsingBoehm object at 0x0000000112d35d70>
def test_finalizer_queue(self):
class A(object):
def __init__(self, i):
self.i = i
class Glob:
triggered = 0
glob = Glob()
class FQ(rgc.FinalizerQueue):
Class = A
triggered = 0
def finalizer_trigger(self):
glob.triggered += 1
fq = FQ()
#
def fn():
for i in range(1000):
x = A(i)
fq.register_finalizer(x)
rgc.may_ignore_finalizer(x) # this is ignored with Boehm
rgc.collect()
rgc.collect()
if glob.triggered == 0:
print "not triggered!"
return 50
seen = {}
while True:
a = fq.next_dead()
if a is None:
break
assert a.i not in seen
seen[a.i] = True
if len(seen) < 500:
print "seen only %d!" % len(seen)
return 51
return 42
> f = self.getcompiled(fn)
translator/c/test/test_boehm.py:434:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
translator/c/test/test_boehm.py:40: in getcompiled
thread=self.use_threads, **extra_options)
translator/c/test/test_genc.py:124: in compile
t.compile_c()
translator/interactive.py:123: in compile_c
self.driver.compile_c()
translator/driver.py:108: in proc
return self.proceed(backend_goal)
translator/driver.py:568: in proceed
result = self._execute(goals, task_skip = self._maybe_skip())
translator/tool/taskengine.py:109: in _execute
self._event('planned', goal, taskcallable)
translator/driver.py:612: in _event
func.task_earlycheck(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <rpython.translator.driver.TranslationDriver object at 0x0000000112d356a8>
def possibly_check_for_boehm(self):
if self.config.translation.gc == "boehm":
from rpython.rtyper.tool.rffi_platform import configure_boehm
from rpython.translator.platform import CompilationError
try:
configure_boehm(self.translator.platform)
except CompilationError as e:
i = 'Boehm GC not installed. Try e.g. "translate.py --gc=minimark"'
> raise Exception(str(e) + '\n' + i)
E Exception: CompilationError(out="""
E /tmp/buildbot-arm64/usession-pytest3.10-1185/platcheck_69.c:92:10: fatal error: 'gc/gc.h' file not found
E 92 | #include <gc/gc.h>
E | ^~~~~~~~~
E 1 error generated.
E """)
E Boehm GC not installed. Try e.g. "translate.py --gc=minimark"
translator/driver.py:403: Exception
(somefailed=True in translator/c/test/test_boehm.py)
builder: rpython-macos-arm64 build #265+
test: translator/c/test/test_boehm.py::TestUsingBoehm::()::test_finalizer_queue