jtreg fails to run under openjdk-8 due to api incompatibility with openjdk-9 or later
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
jtreg (Debian) |
Fix Released
|
Unknown
|
|||
jtreg (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Unassigned | ||
Cosmic |
Fix Released
|
Medium
|
Unassigned | ||
Disco |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
openjdk-9 introduced a few api changes that result in runtime errors when trying to run the java classes under openjdk 8 (or earlier) even when -source/-target are properly set.
The fix is to build such code using the new openjdk-9 flag "--release" instead of the "-source/-target" pair.
When running Cosmic's jtreg 4.2-b13-1 with agentvm under openjdk-8 it will fail and output a few lines such as:
stderr: Exception: java.lang.
The java.lang.
This affects the openjdk-8 build in Cosmic as the jtreg testsuites are run as part of the build. We use the test results for checking regressions from an update.
[Test Case]
For this test case we need to create an empty TEST.ROOT file and a test class to satisfy jtreg requirements of a minimum test. jtreg must also be forced to use openjdk-8.
$ sudo apt install openjdk-8-jdk jtreg
$ touch TEST.ROOT
$ cat > Hello.java << EOF
/*
* @test
* @bug 2718282
* @summary Hello test
*/
public class Hello {
public static void main(String [] args) throws Exception {
if (true)
else
throw new Exception("??");
}
}
EOF
$ JT_JAVA=
[2018-11-15 23:42:34,720] Agent[0]: stderr:
[2018-11-15 23:42:34,721] Agent[0]: stderr: Exception: java.lang.
-------
TEST: Hello.java
TEST JDK: /usr/lib/
[snipped]
Test results: error: 1
Report written to /tmp/JTreport/
Results written to /tmp/JTwork
Error: Some tests failed or other problems occurred.
The expected response from jtreg does not contain the "stderr:" lines as in:
$ JT_JAVA=
-------
TEST: Hello.java
TEST JDK: /usr/lib/
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/
Results written to /tmp/JTwork
Alternatively one can also check that openjdk-lts is not affected by the change, it should output the same before and after the fix:
$ sudo apt install openjdk-11-jdk
$ JT_JAVA=
-------
TEST: Hello.java
TEST JDK: /usr/lib/
[snipped]
Test results: passed: 1
Report written to /tmp/JTreport/
Results written to /tmp/JTwork
[Regression Potential]
1. The --release argument is jdk9+ only, if jtreg is ever build with an older jdk it will FTBFS, so this change should only be backported on releases where the default-jdk is 9+.
2. The --release N argument is equivalent to setting -source N/-target N/-bootclasspath <N bootclasspath>, which can cause issues if the compiled classes use APIs that have been removed or are considered internal. The current jtreg version does not rely on internal classes from jdk 8 (otherwise it would FTBFS) but if a later version does that it will probably FTBFS - note that this is very unlikely as it would mean that upstream decided to break building jtreg with newer jdks.
[Other Info]
See https:/
summary: |
- jtreg fails due to api incompatibility with openjdk-9 or later + jtreg fails to run under openjdk-8 due to api incompatibility with + openjdk-9 or later |
Changed in jtreg (Debian): | |
status: | Unknown → New |
description: | updated |
Changed in jtreg (Debian): | |
status: | New → Fix Released |
Changed in jtreg (Ubuntu): | |
importance: | Undecided → Medium |
Changed in jtreg (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in jtreg (Ubuntu Cosmic): | |
importance: | Undecided → Medium |
Debdiff with the fix for Cosmic.