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

Add JDK 17 to the test matrix #519

Merged
merged 1 commit into from
Dec 27, 2021
Merged
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
6 changes: 6 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
java-version: 16
- name: Store JAVA_16_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_16_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Store JAVA_17_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_17_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 11
uses: actions/setup-java@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
java-version: 16
- name: Store JAVA_16_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_16_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Store JAVA_17_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_17_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Set up Java 11
uses: actions/setup-java@v1
with:
Expand Down
11 changes: 10 additions & 1 deletion btrace-instr/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.nio.file.Files
import java.nio.file.Paths

apply plugin: 'java'

buildscript {
Expand Down Expand Up @@ -82,5 +85,11 @@ test {
//inputs.files buildDTrace.outputs
testLogging.showStandardStreams = true

jvmArgs '--add-opens', 'java.base/jdk.internal.reflect=ALL-UNNAMED', '--add-exports', 'java.base/jdk.internal.reflect=ALL-UNNAMED', "-Dproject.version=${project.version}"
def props = new Properties()
props.load(Files.newInputStream(Paths.get(System.getenv("JAVA_HOME"), "release")))
if (props.getProperty("JAVA_VERSION")?.contains("1.8")) {
jvmArgs "-Dproject.version=${project.version}"
} else {
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions', '--add-opens', 'java.base/jdk.internal.reflect=ALL-UNNAMED', '--add-exports', 'java.base/jdk.internal.reflect=ALL-UNNAMED', "-Dproject.version=${project.version}"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public void testJfr() throws Exception {
releaseProps.load(new FileInputStream(new File(testJavaHome + File.separator + "release")));
rtVersion = releaseProps.getProperty("JAVA_VERSION").replace("\"", "");
}
if (!rtVersion.startsWith("15.")) {
if (!isVersionSafe(rtVersion)) {
// skip the test for 8.0.* because of missing support
// skip all non-LTS versions (except the last one)
// skip the test for JDK 11 since the latest version 11.0.9 and newer ends in SISGSEGV
Expand Down Expand Up @@ -362,4 +362,27 @@ public void validate(String stdout, String stderr, int retcode, String jfrFile)
}
});
}

private static boolean isVersionSafe(String rtVersion) {
String[] versionParts = rtVersion.split("\\.");
int major = Integer.parseInt(versionParts[0]);
int update = Integer.parseInt(versionParts[2].replace("0_", ""));
if (major == 8) {
// before 8u272 there was no JFR support
if (update > 272) {
return true;
}
} else if (major > 9) { // in JDK 9 the dynamic JFR events are missing
if (major == 11) {
// 11.0.9 and 11.0.10 are containing a bug causing the JFR initialization from BTrace to go
// into infinte loop
if (update < 9 || update > 11) {
return true;
}
return false;
}
return true;
}
return false;
}
}
10 changes: 10 additions & 0 deletions btrace-instr/src/test/java/org/openjdk/btrace/RuntimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,16 @@ private Process attach(
if (cmdArgs != null) {
argVals.addAll(Arrays.asList(cmdArgs));
}
if (Files.exists(Paths.get(System.getenv("TEST_JAVA_HOME"), "jmods"))) {
argVals.addAll(
1,
Arrays.asList(
"--add-exports", "jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED"));
}
ProcessBuilder pb = new ProcessBuilder(argVals);

pb.environment().remove("JAVA_TOOL_OPTIONS");
Expand Down
12 changes: 9 additions & 3 deletions config_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ fi

SDKMAN_BASE=$HOME/.sdkman/candidates/java

JAVA_8_VERSION="8.0.282.hs-adpt"
JAVA_8_VERSION="8.0.312-tem"
JAVA_9_VERSION="9.0.4-open"
JAVA_11_VERSION="11.0.9.hs-adpt"
JAVA_16_VERSION="16.0.0.hs-adpt"
JAVA_11_VERSION="11.0.13-tem"
JAVA_16_VERSION="16.0.2-tem"
JAVA_17_VERSION="17.0.1-tem"

echo "Using SDKMAN version: ${SDKMAN_VER}"

Expand All @@ -41,6 +42,11 @@ sdk install java $JAVA_16_VERSION 2>/dev/null || true
export JAVA_16_HOME=$SDKMAN_BASE/$JAVA_16_VERSION
echo "export JAVA_16_HOME=${JAVA_16_HOME}" >> .java.versions

echo "Installing Java 17"
sdk install java $JAVA_17_VERSION 2>/dev/null || true
export JAVA_17_HOME=$SDKMAN_BASE/$JAVA_17_VERSION
echo "export JAVA_17_HOME=${JAVA_17_HOME}" >> .java.versions


echo "==="
echo "Load the configured java version via 'source .java.versions'"
Expand Down
6 changes: 5 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

set -e

for VERSION in 8 9 11 15; do
JAVA_HOME=$JAVA_8_HOME
echo "Building BTrace binary artifacts"
./gradlew -x test :btrace-dist:build

for VERSION in 8 9 11 15 16 17; do
declare home_string=JAVA_${VERSION}_HOME
if [ -z "${!home_string}" ]; then
echo "Skipping test for Java ${VERSINO}"
Expand Down