Skip to content

Commit d0bf0a9

Browse files
committed
[GR-21590] Make GC sensitive tests more reliable and update Graal import.
PullRequest: graalpython/4275
2 parents 3fbbb76 + f387814 commit d0bf0a9

16 files changed

Lines changed: 42 additions & 37 deletions

File tree

ci/graal/ci/common.jsonnet

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ local common_json = import "../common.json";
291291
capabilities+: if self.os == "darwin" then ["!darwin_bigsur", "!darwin_monterey", "!darwin_ventura"] else [],
292292
packages+: if self.os == "linux" then {
293293
cmake: "==3.22.2",
294-
"00:devtoolset": "==12",
295294
} else {},
296295
environment+: if self.os == "windows" then {
297296
local devkits_version = std.filterMap(
@@ -538,11 +537,9 @@ local common_json = import "../common.json";
538537
local common = self.deps.mx + self.deps.common_catch_files + self.deps.common_env,
539538

540539
local ol_devtoolset = {
541-
packages+: (if self.arch == "aarch64" then {
542-
"00:devtoolset": "==10", # GCC 10.2.1, make 4.2.1, binutils 2.35, valgrind 3.16.1
543-
} else {
544-
"00:devtoolset": "==11", # GCC 11.2, make 4.3, binutils 2.36, valgrind 3.17
545-
}),
540+
packages+: {
541+
"00:devtoolset": "==12", # GCC 12.2.1, make 4.3, binutils 2.36, valgrind 3.19
542+
},
546543
},
547544

548545
linux_amd64: self.linux_amd64_ol7,

ci/graal/common.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@
4141
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33", "platformspecific": true },
4242
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-debug", "platformspecific": true },
4343
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-sulong", "platformspecific": true },
44-
"graalvm-ee-21": {"name": "graalvm-java21", "version": "23.1.10", "platformspecific": true },
44+
"graalvm-ee-21": {"name": "graalvm", "version": "21.0.10.0.1-ea.02", "platformspecific": true },
4545

4646
"oraclejdk24": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24.0.1+9", "platformspecific": true, "extrabundles": ["static-libs"]},
4747

48-
"oraclejdk25": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25.0.1+8", "platformspecific": true, "extrabundles": ["static-libs"]},
48+
"oraclejdk25": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25.0.2+10", "platformspecific": true, "extrabundles": ["static-libs"]},
4949
"graalvm-ee-25-ea": {"name": "graalvm-jdk", "version": "25.0.0", "ea": "36", "platformspecific": true },
5050

51-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25.0.1+8", "platformspecific": true, "extrabundles": ["static-libs"]},
52-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-25.0.1+8-jvmci-25.1-b14", "platformspecific": true },
53-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-25.0.1+8-jvmci-25.1-b14-debug", "platformspecific": true },
54-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-25.0.1+8-jvmci-25.1-b14-sulong", "platformspecific": true },
55-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-25.0.1+8-jvmci-25.1-b14", "platformspecific": true },
56-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-25.0.1+8-jvmci-25.1-b14-debug", "platformspecific": true },
57-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-25.0.1+8-jvmci-25.1-b14-sulong", "platformspecific": true }
51+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25.0.2+10", "platformspecific": true, "extrabundles": ["static-libs"]},
52+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-25.0.2+10-jvmci-25.1-b15", "platformspecific": true },
53+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-25.0.2+10-jvmci-25.1-b15-debug", "platformspecific": true },
54+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-25.0.2+10-jvmci-25.1-b15-sulong", "platformspecific": true },
55+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-25.0.2+10-jvmci-25.1-b15", "platformspecific": true },
56+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-25.0.2+10-jvmci-25.1-b15-debug", "platformspecific": true },
57+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-25.0.2+10-jvmci-25.1-b15-sulong", "platformspecific": true }
5858
},
5959

6060
"eclipse": {

ci/python-gate.libsonnet

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@
424424
environment+: $.environment(self.os, self.arch),
425425
packages+: $.packages(self.os, self.arch),
426426
run+: [
427-
// TODO: remove inlineVerifierInstrument=false once VerifierInstrument#checkFrameIsEmpty is fixed, GR-72201
428-
["mx", "--J", "@-Dtck.inlineVerifierInstrument=false"] + self.mx_parameters + self.dy + self.primary_suite + [
427+
["mx"] + self.mx_parameters + self.dy + self.primary_suite + [
429428
"--strict-compliance", "--primary", "gate", "--tags", self.tags, "-B=--force-deprecation-as-warning",
430429
] + self.all_suites + self.gate_parameters,
431430
],

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_contextlib.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ test.test_contextlib.ContextManagerTestCase.test_contextmanager_trap_yield_after
1818
test.test_contextlib.ContextManagerTestCase.test_contextmanager_wrap_runtimeerror @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
1919
test.test_contextlib.ContextManagerTestCase.test_instance_docstring_given_cm_docstring @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
2020
test.test_contextlib.ContextManagerTestCase.test_keywords @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
21-
test.test_contextlib.ContextManagerTestCase.test_nokeepref @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
21+
# GR-73564 - regression in Truffle
22+
!test.test_contextlib.ContextManagerTestCase.test_nokeepref @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
2223
test.test_contextlib.ContextManagerTestCase.test_param_errors @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
2324
test.test_contextlib.ContextManagerTestCase.test_recursive @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github
2425
test.test_contextlib.FileContextTestCase.testWithOpen @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5851,7 +5851,7 @@ def check_resource_tracker_death(self, signum, should_die):
58515851
# ensure `sem` gets collected, which triggers communication with
58525852
# the semaphore tracker
58535853
del sem
5854-
gc_collect()
5854+
gc_collect(lambda: wr())
58555855
self.assertIsNone(wr())
58565856
if should_die:
58575857
self.assertEqual(len(all_warn), 1)

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def captured_stdin():
769769
return captured_output("stdin")
770770

771771

772-
def gc_collect():
772+
def gc_collect(until = None):
773773
"""Force as many objects as possible to be collected.
774774
775775
In non-CPython implementations of Python, this is needed because timely
@@ -784,9 +784,16 @@ def gc_collect():
784784
if is_graalpy:
785785
time.sleep(0.1)
786786
gc.collect()
787-
if is_graalpy:
788-
time.sleep(0.1)
789-
gc.collect()
787+
if until:
788+
i = 0
789+
while until():
790+
if is_graalpy:
791+
time.sleep(0.1)
792+
gc.collect()
793+
i += 1
794+
if i > 1000:
795+
print("WARNING: timeout while waiting for GC")
796+
break
790797

791798
@contextlib.contextmanager
792799
def disable_gc():

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class X:
9292
a.x.a = a
9393
ref = weakref.ref(a.x)
9494
del a
95-
support.gc_collect()
95+
support.gc_collect(lambda: ref())
9696
self.assertIsNone(ref())
9797

9898
def test_snippets(self):

graalpython/lib-python/3/test/test_concurrent_futures/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ def test_free_reference(self):
106106
for obj in self.executor.map(make_dummy_object, range(10)):
107107
wr = weakref.ref(obj)
108108
del obj
109-
support.gc_collect() # For PyPy or other GCs.
109+
support.gc_collect(wr()) # For PyPy or other GCs.
110110
self.assertIsNone(wr())

graalpython/lib-python/3/test/test_concurrent_futures/test_as_completed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ def test_free_reference_yielded_future(self):
8484
futures_list.remove(future)
8585
wr = weakref.ref(future)
8686
del future
87-
support.gc_collect() # For PyPy or other GCs.
87+
support.gc_collect(wr()) # For PyPy or other GCs.
8888
self.assertIsNone(wr())
8989

9090
futures_list[0].set_result("test")
9191
for future in futures.as_completed(futures_list):
9292
futures_list.remove(future)
9393
wr = weakref.ref(future)
9494
del future
95-
support.gc_collect() # For PyPy or other GCs.
95+
support.gc_collect(wr()) # For PyPy or other GCs.
9696
self.assertIsNone(wr())
9797
if futures_list:
9898
futures_list[0].set_result("test")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def woohoo(a, b):
342342
a = weakref.ref(a)
343343
b = weakref.ref(b)
344344
# Allow test to work with a non-refcounted GC
345-
support.gc_collect()
345+
support.gc_collect(lambda: a() or b())
346346
self.assertIsNone(a())
347347
self.assertIsNone(b())
348348
yield

0 commit comments

Comments
 (0)