Skip to content

Commit 2bafac7

Browse files
committed
Use support.gc_collect in test_descr + heap dump on support.gc_collect failure
1 parent 6959baa commit 2bafac7

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

ci/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ Jsonnet/libsonnet CI definitions consumed by GitHub Actions matrix generation.
1616
## ANTI-PATTERNS
1717
- Don’t encode secrets or environment-specific paths here.
1818
- Keep changes compatible with matrix generation (small diffs, deterministic output).
19+
- NEVER edit CI files in `./graal`

ci/python-gate.libsonnet

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,10 @@
408408
python_version: "3.8",
409409
targets: [self.target],
410410
logs+: $.logs(self.os, self.arch),
411+
catch_files+: [
412+
// generated by patch in CPython test support
413+
"HEAP DUMP: (?P<filename>.+\\.hprof)",
414+
],
411415
// all gates share the same base set of downloads
412416
downloads+: $.downloads(self.os, self.arch),
413417
// all gates share the same base environment

graalpython/lib-python/3/test/support/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,9 @@ def gc_collect(until = None):
793793
i += 1
794794
if i > 1000:
795795
print("WARNING: timeout while waiting for GC")
796+
if is_graalpy and hasattr(__graalpython__, 'dump_heap'):
797+
dump_path = __graalpython__.dump_heap()
798+
print(f"HEAP DUMP: {dump_path}")
796799
break
797800

798801
@contextlib.contextmanager

graalpython/lib-python/3/test/test_descr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5016,7 +5016,7 @@ class Child(Parent):
50165016
self.assertEqual(Parent.__subclasses__(), [Child])
50175017

50185018
del Child
5019-
gc.collect()
5019+
support.gc_collect(lambda: len(Parent.__subclasses__()) > 0)
50205020
self.assertEqual(Parent.__subclasses__(), [])
50215021

50225022
def test_attr_raise_through_property(self):

0 commit comments

Comments
 (0)