Skip to content

Commit e1e751d

Browse files
author
Vladimir Sitnikov
committed
test: add IBM Semeru Java distribution to test matrix
Semeru uses Open9J JIT, so it might behave differently from the other OpenJDK distributions, so it is assigned a greater weight in the test matrix. The option for testing with "same hashcode" -XX:hashCode=2 is moved to Test task execution only since javac, and kotlinc do not behave well with "same hashcode".
1 parent 9540f4e commit e1e751d

File tree

4 files changed

+57
-44
lines changed

4 files changed

+57
-44
lines changed

Diff for: .github/workflows/gradle.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,19 @@ jobs:
5454
with:
5555
script: |
5656
console.log('The following command might help reproducing CI results, use Java ${{ matrix.java_version }}')
57-
console.log('TZ="${{ matrix.tz }}" _JAVA_OPTIONS="${{ matrix.testExtraJvmArgs }}" ./gradlew check ${{ matrix.extraGradleArgs }}')
57+
console.log('TZ="${{ matrix.tz }}" _JAVA_OPTIONS="${{ matrix.extraJvmArgs }}" ./gradlew check ${{ matrix.extraGradleArgs }} -PtestExtraJvmArgs="${{ matrix.testExtraJvmArgs }}"')
5858
5959
- uses: burrunan/gradle-cache-action@v1
6060
# See https://github.com/burrunan/gradle-cache-action
6161
name: Build and Test
6262
env:
63-
_JAVA_OPTIONS: ${{ matrix.testExtraJvmArgs }}
63+
_JAVA_OPTIONS: ${{ matrix.extraJvmArgs }}
6464
with:
6565
# It allows different cache contents for different JDKs
6666
job-id: java${{ matrix.java_version }}
6767
arguments: check -DshowStandardStreams=true ${{ matrix.extraGradleArgs }}
68+
properties: |
69+
testExtraJvmArgs=${{ matrix.testExtraJvmArgs }}
6870
6971
# - name: Publish Test Report
7072
# uses: scacap/action-surefire-report@v1

Diff for: .github/workflows/matrix.js

+25-17
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ const matrix = new MatrixBuilder();
2020
matrix.addAxis({
2121
name: 'java_distribution',
2222
values: [
23-
'corretto',
24-
'liberica',
25-
'microsoft',
26-
'oracle',
27-
'temurin',
28-
'zulu',
23+
{value: 'corretto', weight: 1},
24+
{value: 'liberica', weight: 1},
25+
{value: 'microsoft', weight: 1},
26+
{value: 'oracle', weight: 1},
27+
{value: 'semeru', weight: 4},
28+
{value: 'temurin', weight: 1},
29+
{value: 'zulu', weight: 1},
2930
]
3031
});
3132

32-
// TODO: support different JITs (see https://github.com/actions/setup-java/issues/279)
33-
matrix.addAxis({name: 'jit', title: '', values: ['hotspot']});
34-
3533
// See the supported versions at https://foojay.io/almanac/java-17/
3634
matrix.addAxis({
3735
name: 'java_version',
@@ -92,12 +90,16 @@ matrix.setNamePattern([
9290
'tz', 'locale',
9391
]);
9492

93+
// Semeru uses OpenJ9 jit which has no option for making hash codes the same
94+
// See https://github.com/eclipse-openj9/openj9/issues/17309
95+
matrix.exclude({java_distribution: {value: 'semeru'}, hash: {value: 'same'}});
96+
matrix.exclude({java_distribution: {value: 'semeru'}, java_version: '19'});
9597
// Microsoft Java has no distribution for 8, 18, 19
96-
matrix.exclude({java_distribution: 'microsoft', java_version: '8'});
97-
matrix.exclude({java_distribution: 'microsoft', java_version: '18'});
98-
matrix.exclude({java_distribution: 'microsoft', java_version: '19'});
98+
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '8'});
99+
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '18'});
100+
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '19'});
99101
// Oracle supports 17+ only
100-
matrix.exclude({java_distribution: 'oracle', java_version: ['8', '11', '19']});
102+
matrix.exclude({java_distribution: {value: 'oracle'}, java_version: ['8', '11', '19']});
101103
// TODO: remove when compileJava with "same hashcode" issues are resolved
102104
// See https://bugs.openjdk.org/browse/JDK-8288590 is resolved
103105
// See https://github.com/jqwik-team/jqwik/pull/460#issuecomment-1428261036
@@ -133,14 +135,19 @@ include.forEach(v => {
133135
});
134136
include.forEach(v => {
135137
let jvmArgs = [];
136-
138+
// Extra JVM arguments passed to test execution
139+
let testJvmArgs = [];
137140
if (v.hash.value === 'same') {
138-
jvmArgs.push('-XX:+UnlockExperimentalVMOptions', '-XX:hashCode=2');
141+
// javac has issues with "same hashcode" option (see https://bugs.openjdk.org/browse/JDK-8288590)
142+
// On the other hand, kotlinc uses "object identity" a lot. It works properly,
143+
// but it becomes slow as HashMap degrades. So we pass "same hashcode" to test executions only.
144+
testJvmArgs.push('-XX:+UnlockExperimentalVMOptions', '-XX:hashCode=2');
139145
}
140146
// Pass locale via _JAVA_OPTIONS so all the forked processes inherit it
141147
jvmArgs.push(`-Duser.country=${v.locale.country}`);
142148
jvmArgs.push(`-Duser.language=${v.locale.language}`);
143-
if (v.jit === 'hotspot' && Math.random() > 0.5) {
149+
v.java_distribution = v.java_distribution.value;
150+
if (v.java_distribution !== 'semeru' && Math.random() > 0.5) {
144151
// The following options randomize instruction selection in JIT compiler
145152
// so it might reveal missing synchronization in TestNG code
146153
v.name += ', stress JIT';
@@ -164,7 +171,8 @@ include.forEach(v => {
164171
jvmArgs.push('-XX:+StressCCP');
165172
}
166173
}
167-
v.testExtraJvmArgs = jvmArgs.join(' ');
174+
v.extraJvmArgs = jvmArgs.join(' ');
175+
v.testExtraJvmArgs = testJvmArgs.join(' ::: ');
168176
delete v.hash;
169177
});
170178

Diff for: build.gradle

-25
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,3 @@ plugins {
1111
wrapper {
1212
gradleVersion = '8.0.2'
1313
}
14-
15-
allprojects {
16-
tasks.withType(ProcessForkOptions).configureEach {
17-
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
18-
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
19-
}
20-
21-
tasks.withType(JavaCompile).configureEach {
22-
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
23-
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
24-
}
25-
26-
tasks.withType(Test).configureEach {
27-
def language = System.getProperty("user.language") ?: "TR"
28-
if (language != null) {
29-
systemProperty("user.language", language)
30-
}
31-
def country = System.getProperty("user.country") ?: "tr"
32-
if (country != null) {
33-
systemProperty("user.country", country)
34-
}
35-
// Tests might depend on timezone, so treat it as an input
36-
inputs.property("ENV:TZ", providers.environmentVariable("TZ")).optional(true)
37-
}
38-
}

Diff for: buildSrc/src/main/groovy/jqwik.common-configuration.gradle

+28
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,34 @@ tasks.withType(Javadoc) {
6666
options.addStringOption('Xdoclint:none', '-quiet')
6767
}
6868

69+
tasks.withType(ProcessForkOptions).configureEach {
70+
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
71+
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
72+
}
73+
74+
tasks.withType(JavaCompile).configureEach {
75+
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
76+
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
77+
}
78+
79+
tasks.withType(Test).configureEach {
80+
def language = System.getProperty("user.language") ?: "TR"
81+
if (language != null) {
82+
systemProperty("user.language", language)
83+
}
84+
def country = System.getProperty("user.country") ?: "tr"
85+
if (country != null) {
86+
systemProperty("user.country", country)
87+
}
88+
// Tests might depend on timezone, so treat it as an input
89+
inputs.property("ENV:TZ", providers.environmentVariable("TZ")).optional(true)
90+
91+
def testExtraJvmArgs = project.findProperty("testExtraJvmArgs")
92+
if (testExtraJvmArgs instanceof String) {
93+
jvmArgs(testExtraJvmArgs.split(" ::: "))
94+
}
95+
}
96+
6997
// Enable to get more compiler warnings.
7098
// tasks.withType(JavaCompile) {
7199
// options.compilerArgs << '-Xlint:unchecked'

0 commit comments

Comments
 (0)