Skip to content

Commit 95283c8

Browse files
committed
possible testlens fix for JDK25
1 parent 9ccd6a7 commit 95283c8

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/groovy-build-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
- name: "🐘 Setup Gradle"
5454
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
5555
- name: "🔍 Setup TestLens"
56-
if: matrix.java != 25
5756
uses: testlens-app/setup-testlens@v1
5857
- name: "🏃Test with Gradle"
5958
run: ./gradlew test -Ptarget.java.home="$JAVA_HOME_${{ matrix.java }}_${{ runner.arch }}"

src/test/groovy/org/codehaus/groovy/runtime/m12n/ExtensionModuleHelperForTests.groovy

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,23 @@ final class ExtensionModuleHelperForTests {
5252

5353
def ant = new AntBuilder()
5454
def allowed = [
55-
'Picked up JAVA_TOOL_OPTIONS: .*',
56-
'Picked up _JAVA_OPTIONS: .*'
55+
~/Picked up JAVA_TOOL_OPTIONS: .*/,
56+
~/Picked up _JAVA_OPTIONS: .*/
5757
]
58+
def jvmArgs = []
59+
if (Runtime.version().feature() == 25) {
60+
// JEP 471/498: silence terminal-deprecation warnings for sun.misc.Unsafe
61+
// memory-access methods called from agents on the inherited classpath
62+
// (e.g. testlens's shaded protobuf UnsafeUtil::arrayBaseOffset).
63+
// remove when we can - this could mask errors we want to pick up
64+
jvmArgs << '--sun-misc-unsafe-memory-access=allow'
65+
}
5866
try {
5967
ant.with {
6068
taskdef(name: 'groovyc', classname: 'org.codehaus.groovy.ant.Groovyc')
6169
groovyc(srcdir: baseDir.absolutePath, destdir: baseDir.absolutePath, includes: 'Temp.groovy', fork: true)
6270
java(classname: 'Temp', fork: 'true', outputproperty: 'out', errorproperty: 'err') {
71+
jvmArgs.each { jvmarg(value: it) }
6372
classpath {
6473
cp.each {
6574
pathelement location: it
@@ -71,8 +80,11 @@ final class ExtensionModuleHelperForTests {
7180
baseDir.deleteDir()
7281
String out = ant.project.properties.out
7382
String err = ant.project.properties.err
74-
if (err && !allowed.any{ err.trim().matches(it) }) {
75-
throw new RuntimeException("$err\nClasspath: ${cp.join('\n')}")
83+
def stray = err?.readLines()?.findAll { line ->
84+
line.trim() && !allowed.any { line ==~ it }
85+
} ?: []
86+
if (stray) {
87+
throw new RuntimeException("${stray.join('\n')}\nClasspath: ${cp.join('\n')}")
7688
}
7789
if (out && (out.contains('FAILURES') || !out.contains('OK'))) {
7890
throw new RuntimeException("$out\nClasspath: ${cp.join('\n')}")

0 commit comments

Comments
 (0)