Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add IBM Semeru Java distribution to test matrix #481

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
env:
MATRIX_JOBS: 4
MATRIX_JOBS: 15
steps:
- uses: actions/checkout@v3
- id: set-matrix
Expand All @@ -36,7 +36,7 @@ jobs:
needs: matrix_prep
strategy:
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
# fail-fast: false
fail-fast: false
env:
TZ: ${{ matrix.tz }}
steps:
Expand All @@ -54,17 +54,19 @@ jobs:
with:
script: |
console.log('The following command might help reproducing CI results, use Java ${{ matrix.java_version }}')
console.log('TZ="${{ matrix.tz }}" _JAVA_OPTIONS="${{ matrix.testExtraJvmArgs }}" ./gradlew check ${{ matrix.extraGradleArgs }}')
console.log('TZ="${{ matrix.tz }}" _JAVA_OPTIONS="${{ matrix.extraJvmArgs }}" ./gradlew check ${{ matrix.extraGradleArgs }} -PtestExtraJvmArgs="${{ matrix.testExtraJvmArgs }}"')

- uses: burrunan/gradle-cache-action@v1
# See https://github.com/burrunan/gradle-cache-action
name: Build and Test
env:
_JAVA_OPTIONS: ${{ matrix.testExtraJvmArgs }}
_JAVA_OPTIONS: ${{ matrix.extraJvmArgs }}
with:
# It allows different cache contents for different JDKs
job-id: java${{ matrix.java_version }}
arguments: check -DshowStandardStreams=true ${{ matrix.extraGradleArgs }}
properties: |
testExtraJvmArgs=${{ matrix.testExtraJvmArgs }}

# - name: Publish Test Report
# uses: scacap/action-surefire-report@v1
Expand Down
42 changes: 25 additions & 17 deletions .github/workflows/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@ const matrix = new MatrixBuilder();
matrix.addAxis({
name: 'java_distribution',
values: [
'corretto',
'liberica',
'microsoft',
'oracle',
'temurin',
'zulu',
{value: 'corretto', weight: 1},
{value: 'liberica', weight: 1},
{value: 'microsoft', weight: 1},
{value: 'oracle', weight: 1},
{value: 'semeru', weight: 4},
{value: 'temurin', weight: 1},
{value: 'zulu', weight: 1},
]
});

// TODO: support different JITs (see https://github.com/actions/setup-java/issues/279)
matrix.addAxis({name: 'jit', title: '', values: ['hotspot']});

// See the supported versions at https://foojay.io/almanac/java-17/
matrix.addAxis({
name: 'java_version',
Expand Down Expand Up @@ -92,12 +90,16 @@ matrix.setNamePattern([
'tz', 'locale',
]);

// Semeru uses OpenJ9 jit which has no option for making hash codes the same
// See https://github.com/eclipse-openj9/openj9/issues/17309
matrix.exclude({java_distribution: {value: 'semeru'}, hash: {value: 'same'}});
matrix.exclude({java_distribution: {value: 'semeru'}, java_version: '19'});
// Microsoft Java has no distribution for 8, 18, 19
matrix.exclude({java_distribution: 'microsoft', java_version: '8'});
matrix.exclude({java_distribution: 'microsoft', java_version: '18'});
matrix.exclude({java_distribution: 'microsoft', java_version: '19'});
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '8'});
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '18'});
matrix.exclude({java_distribution: {value: 'microsoft'}, java_version: '19'});
// Oracle supports 17+ only
matrix.exclude({java_distribution: 'oracle', java_version: ['8', '11', '19']});
matrix.exclude({java_distribution: {value: 'oracle'}, java_version: ['8', '11', '19']});
// TODO: remove when compileJava with "same hashcode" issues are resolved
// See https://bugs.openjdk.org/browse/JDK-8288590 is resolved
// See https://github.com/jqwik-team/jqwik/pull/460#issuecomment-1428261036
Expand Down Expand Up @@ -133,14 +135,19 @@ include.forEach(v => {
});
include.forEach(v => {
let jvmArgs = [];

// Extra JVM arguments passed to test execution
let testJvmArgs = [];
if (v.hash.value === 'same') {
jvmArgs.push('-XX:+UnlockExperimentalVMOptions', '-XX:hashCode=2');
// javac has issues with "same hashcode" option (see https://bugs.openjdk.org/browse/JDK-8288590)
// On the other hand, kotlinc uses "object identity" a lot. It works properly,
// but it becomes slow as HashMap degrades. So we pass "same hashcode" to test executions only.
testJvmArgs.push('-XX:+UnlockExperimentalVMOptions', '-XX:hashCode=2');
}
// Pass locale via _JAVA_OPTIONS so all the forked processes inherit it
jvmArgs.push(`-Duser.country=${v.locale.country}`);
jvmArgs.push(`-Duser.language=${v.locale.language}`);
if (v.jit === 'hotspot' && Math.random() > 0.5) {
v.java_distribution = v.java_distribution.value;
if (v.java_distribution !== 'semeru' && Math.random() > 0.5) {
// The following options randomize instruction selection in JIT compiler
// so it might reveal missing synchronization in TestNG code
v.name += ', stress JIT';
Expand All @@ -164,7 +171,8 @@ include.forEach(v => {
jvmArgs.push('-XX:+StressCCP');
}
}
v.testExtraJvmArgs = jvmArgs.join(' ');
v.extraJvmArgs = jvmArgs.join(' ');
v.testExtraJvmArgs = testJvmArgs.join(' ::: ');
delete v.hash;
});

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/matrix_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,13 @@ class MatrixBuilder {
return title;
}
const computeTitle = this.axisByName[axisName].title;
return computeTitle ? computeTitle(value) : value;
if (computeTitle) {
return computeTitle(value);
}
if (typeof value === 'object' && value.hasOwnProperty('value')) {
return value.value;
}
return value;
}).filter(Boolean).join(", ");
this.rows.push(res);
return res;
Expand Down
25 changes: 0 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,3 @@ plugins {
wrapper {
gradleVersion = '8.0.2'
}

allprojects {
tasks.withType(ProcessForkOptions).configureEach {
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
}

tasks.withType(JavaCompile).configureEach {
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
}

tasks.withType(Test).configureEach {
def language = System.getProperty("user.language") ?: "TR"
if (language != null) {
systemProperty("user.language", language)
}
def country = System.getProperty("user.country") ?: "tr"
if (country != null) {
systemProperty("user.country", country)
}
// Tests might depend on timezone, so treat it as an input
inputs.property("ENV:TZ", providers.environmentVariable("TZ")).optional(true)
}
}
28 changes: 28 additions & 0 deletions buildSrc/src/main/groovy/jqwik.common-configuration.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,34 @@ tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}

tasks.withType(ProcessForkOptions).configureEach {
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
}

tasks.withType(JavaCompile).configureEach {
// Prevent Gradle build cache reuse for different _JAVA_OPTIONS
inputs.property("ENV:_JAVA_OPTIONS", providers.environmentVariable("_JAVA_OPTIONS")).optional(true)
}

tasks.withType(Test).configureEach {
def language = System.getProperty("user.language") ?: "TR"
if (language != null) {
systemProperty("user.language", language)
}
def country = System.getProperty("user.country") ?: "tr"
if (country != null) {
systemProperty("user.country", country)
}
// Tests might depend on timezone, so treat it as an input
inputs.property("ENV:TZ", providers.environmentVariable("TZ")).optional(true)

def testExtraJvmArgs = project.findProperty("testExtraJvmArgs")
if (testExtraJvmArgs instanceof String && !testExtraJvmArgs.isEmpty()) {
jvmArgs(testExtraJvmArgs.split(" ::: "))
}
}

// Enable to get more compiler warnings.
// tasks.withType(JavaCompile) {
// options.compilerArgs << '-Xlint:unchecked'
Expand Down